An internal class
1 member Inner class
???????????? Class 1.1, outside called outer outer class, inside called inner inner class
????????????? 1.2 Inner class usually attendant outside class, externally with invisible
???????????? 1.3 objects are typically created in an external class
???????????? 1.4 Direct access to all members of the outer class, an implicit reference to the outer class object that created it, and the external name of the
2 Anonymous inner class:
- ??? To create an object of a class and create it only once, the class does not have to be named, which is called an anonymous inner class.
- In an anonymous inner class, if you want to access an external variable, the variable must be final------------jdk1.7 and before
Two interfaces:
-
- is a data type (reference type)
- There is a interface definition
- can only contain constants and abstract methods
- Interface cannot be instantiated
- Interfaces are required to be implemented or inherited, implementations or inheriting classes must override all methods in an interface
- A class can implement multiple interfaces, separated, and if inherited and implemented, must first inherit after implementation
- Interfaces can inherit interfaces
Three design rules:
1 properties and behaviors common to all derived classes pumped into the superclass---pumping commonalities
2 All derived classes behave the same as normal methods, all derived classes behave differently, and are set to abstract methods
3 to extract the behavior shared by some derived classes into the connector
An interface is an extension of the inheritance of a single root = = Multiple inheritance
Use interfaces when both inherit and implement
Java object-oriented internal classes and interfaces