/** * Snmall example of scoping in java. * This will print * 1 * 4 * 1 * The class instance is not changed because var is a new variable in scopetest. **/ public class Scoper { int var = 1; public void scopetest(int vv) { System.out.println(var); { int var = vv+2; System.out.println(var); } System.out.println(var); } public static void main(String args[]) { Scoper s = new Scoper(); s.scopetest(2); } }