I. Definition of an internal class
The analogy of a class to a person, combination, inheritance, interface, etc. is "outward" to develop their own meaning, while the inner class can be regarded as "inward" ascension of this meaning.
The definition of an inner class is that the definition of a class is written inside another class, it is convenient to organize some related classes together and control it to be visible only inside.
Ii. Classification of internal categories
Inner classes can be divided into three types: member inner class, local inner class, anonymous inner class. A member inner class is a class that is defined inside a class, where the position is equal to the member variable, and the local inner class is defined within a method, and the position is equivalent to a local variable.
1 Public classTest {2 3 Public classA {4 //A is the member's inner class5 }6 7 Public voidf () {8 classB {9 //B is the local inner classTen } One } A - PublicIntf m () { - return NewIntf () { the @Override - Public voidT () { - //This is an anonymous inner class . - } + }; - } + } A at InterfaceIntf { - Public voidt (); -}
Iii. Creation of internal classes
Pending additions
Vii. Internal Classes