1) The advantage of an inner class is that the inner class can access the private member variable of the outer class without needing the object of the new outer class.
2) The inner class is divided into: Static inner class, anonymous inner class, local inner class, member inner class.
3) The scenario for static inner classes is that only static member variables and static member methods of external classes can be accessed.
4) The application scenario for a member's inner class is that it can access all the member variables and methods of its outer class, whether static or non-static.
5) Local inner classes: Like local variables, cannot be modified by public, protected, private, and static. Only local variables of the final type defined in the method can be accessed.
6) Anonymous inner class: Anonymous inner class is a local inner class without a name, not using the keyword class, extends, implements, no constructor method. An anonymous inner class implicitly inherits a parent class or implements an interface. Anonymous inner classes are used more often as a method parameter.
Summary of internal class usage in Java