public classA {String s = "outer class member variable";//member Variables public voidMethod () {//member Methods FinalString S1 = "inner class variable";//Local Variables classInnerclass {//local inner class public voidInnermethod () {//local Inner class method intTest = 20; System.out.println (s); System.out.println ("Integer value is:" +test); System.out.println (s1); }} Innerclass b=NewInnerclass (); can only be instantiated in a local inner class. B.innermethod (); And only methods in the class can be called, and external methods cannot be called. } public Static voidmain (string[] Args) {a a=NewA (); A.method (); }}
One the inner class defined in the method body (local inner Class) innerclass can only access local variables that are declared final as defined in the Method. Member variables are not final Decorated.
second, The local inner class can only be instantiated in the class, and can only invoke methods inside that class. is not instantiated and invoked in an external class.
third, the Operation Result:
Member variables, local variables, local inner classes, local inner class method scope problems in Java.