What is the result of the following code?
1: public class Outer { 2: private int x = 5; 3: protected class Inner { 4: public static int x = 10; 5: public void go() { System.out.println(x); } 6: } /* ww w . ja v a2s. c o m*/ 7: public static void main(String[] args) { 8: Outer out = new Outer(); 9: Outer.Inner in = out.new Inner(); 10: in.go(); 11: } }
C.
Inner is a member inner class.
Inner classes are not allowed to contain static methods or static variables.
Only nested static classes are permitted to contain statics.