1. public class
Test {
2. public int aMethod() {
3. static int i = 0;
4. i++;
5. return i;
6. }
7. public static void main (
String args[]) {
8. Test test = new Test();
9. test.aMethod();
10. int j = test.aMethod();
11. System.out.println(j);
12. }
13. }
What is the result?
A. 0
B. 1
C. 2
D. Compilation fails.
At line no 9 ..it calls to a.Method() where i increments and its value is 1.
At line 10 its calling to aMetod() again and it increments the value to 2.
or....is the declaration on line 10 is wrong.