Internal class Access features:
1, the inner class can access the members of the external class directly.
2, an external class must establish an inner class object to access the inner class.
Why does an inner class have direct access to members of an external class?
That's because the inner class holds references to external classes. External class name. This
The inner class can be stored in a local location.
The inner class can only access local variables that are final decorated locally in local locations.
Anonymous inner class. is the shorthand format for the inner class.
Must have a premise:
An inner class must inherit or implement an external class or interface.
Anonymous inner class: is actually an anonymous subclass object.
Format: New parent class or interface () {Subclass content}
One of the usual usage scenarios:
When a function parameter is an interface type, and there are no more than three methods in the interface.
can be passed as actual parameters with an anonymous inner class
Java Internal classes