Methods inner classes, members of inner classes, static inner classes, anonymous inner classes
1. Method inner class
public class the Person { public static void main (String [] args) { // . inside the object is to call the external object method --- (); in the class object to create an internal process, and to call the class object through the inside of the internal with method new new OUT () m ();. } } class OUT { int B = 0 ; public void n-() { Final int K2 = 10 ; m (); // n-m calling method } public void m () { int K = 10; // in jdk1.7 and to be explicitly indicates that the former is a constant (to add final), is explicitly constant //It is implicit and after jdk1.8 constant (as long as the definition of a variable is constant), when the inner class is used to constant // Method inner class / ** 1. only non-static definition of the properties and methods * 2 .final methods and properties can also be modified * 3. statically defined constants (static Final) * 4. able to be outside all the attributes and methods of the class * 5. the method may get inside this class contain constants, variables declared at this time also implicitly converted into constant (plus the final) * 6. can inherit from other classes * 7. shall not be allowed access modifiers before the inner class, only add final or abstract (abstract) * 8. how create an object inside the class? Still other methods can not be created inside the class object, this method can only be created within * 9 other method is to first call within the internal object --- external object method ();.. Create an internal class object in the method, and invokes properties and methods by inner class internal class object * / class Inner1 the extends Object { static Final int A = 2 ; void M2 () { //You can get property methods of the class external System.out.println (B); // // can get method constant System.out.println (k); // k =. 11; // here being given as k is an implicit constant, can not be modified // not get contains no constant process this inner class // System.out.println (K2); } // endm2 () } // End inner class // create internal class object Inner1 = Nei new new Inner1 (); nei.m2 (); // method inner class calls } // ENDM () } // endout class