/** * Illustration of scoping in java * @author gtowell * Created: Feb 11, 2020 */ public class ScopeTest { private int var = 1; // instance variable -- horribly named /** * What happens when you use a variable tht has the same name as an instance variable? * @param vv some number */ public void scopes(int vv) { System.out.println(var); { int var = vv+2; System.out.println(var); } System.out.println(var); } public static void main(String args[]) { ScopeTest s = new ScopeTest(); s.scopes(2); } }