Two days ago the school broke the net, failed to write in time, today summed up the rest of the internal classes learned.
1. Inner classes declared as static are generally referred to as nested classes. An ordinary inner class object implicitly holds a reference to a perimeter object that creates it, but not when the inner class is static:
(1). To create an object of the static inner class, it does not require its enclosing class object;
(2). Non-static perimeter class objects cannot be accessed with objects of the static inner class.
Classes can be created in interfaces, but are automatically public and static types, and can even be implemented in an internal class of an interface.
2. Reasons for using internal classes:
(1). Because the inner class allows inheriting multiple non-interface types (that is, creating multiple inner classes to inherit separately), this allows multiple inheritance to be implemented in Java;
(2). An inner class can have multiple instances, each with its own state information and independent of the external object information;
(3). In a single perimeter class, you can make multiple inner classes implement the same interface in different ways or inherit the same class;
(4). The inner class does not have a "is-a" relationship, it is a separate entity.
3. The inner class cannot be overridden by subclasses of the outer class.
Self-Study Java chapter Tenth inner Class (III)