1. member Inner class
The member inner class, which is a member of an external class, can directly use all members and methods of the outer class, even if it is private. While the outer class accesses all member variables/methods of the inner class, it needs to be fetched through the object of the inner class.
2. Local inner class
A local inner class, which refers to an inner class definition within a method and scope. Local inner classes are compiled just like other classes, but only in different scopes, only within the scope of the method or condition, and cannot be referenced after exiting these scopes.
3. Nesting inner classes
Nested inner classes are the inner class that is decorated as static. An inner class declared as static does not require a connection between an inner class object and an external class object, which means that we can refer directly to Outer.Inner, which means that you do not need to create an external class or create an inner class.
There is another difference between nested classes and ordinary inner classes: ordinary inner classes cannot have static data and static properties, and cannot contain nested classes, but nested classes can. Nested classes cannot be declared private, and are generally declared public for easy invocation.
4. Anonymous inner class
An anonymous inner class is an inner class without a name, and because there is no name, an anonymous inner class can only be used once, and it is often used to simplify code writing, but there are prerequisites for using anonymous inner classes: You must inherit from a parent class or implement an interface
Java Internal Classes