class Scope { public int x; // This is a public variable for the class 'Scope' public void main() { int x; // We define a new variable 'x' which will hide int i; // the previous defined 'x'. int k; x = 3; // Here 'x' refer to the method varaibale // The second 'x' declared. this.x = 2; // To access the class variable you need // to use the keyword 'this'. // Here's a block of code that is WRONG! There is already a // variable 'i' in the 'main()' method. for (int i=0; i<1; i++) { A a = new A(); a.M1(); } // Now lets declare a new variable 'j' in the method 'main()'. for (int j=0; j<1; j++) { int j; // WRONG! Variable 'j' already exists in this method. } } }