Nested classes include: 1) statically nested class (static modifier)
2) non-static nested class (also called Inner Class)
The inner class can be divided into three kinds:
One, the inner class directly defined in a class (outer class);
Second, the inner class defined in a method (the method of the outer class);
Its third, anonymous inner class.
Summary of access rules:
1) Static nesting class:
1. Static nested classes can access static member variables of external classes directly, but cannot directly access non-static member variables of external classes whose access rules are similar to static member variables, where static methods cannot directly access non-static members.
2. External classes cannot directly access member variables of static nested classes, but they can access member variables of statically nested classes through class objects.
2) Inner class:
1. Internal classes can directly access static and non-static member variables of external classes (including private access rights).
2. The external class can access the private member variables of the inner class class directly through the class object of the inner class.
Java nested class précis-writers