Member Inner Classes
Sub type of Inner Classes!!!
It is defined at the same level as the member functions, constructors and fields.
Instantiating object of the Member Inner Class :
-Create an object of the outer class.
-Using object of the outer class create object of the inner class.
-If you want to use the inner class within the class ( say inside a method ),
just create an object of the inner class there. Thats it!
When we compile the java class ( OuterClass ) which has a inner class ( InnerClass ) , two class files are created :
1. OuterClass.class
2. OuterClass$InnerClass.class
It is defined at the same level as the member functions, constructors and fields.
Instantiating object of the Member Inner Class :
-Create an object of the outer class.
-Using object of the outer class create object of the inner class.
-If you want to use the inner class within the class ( say inside a method ),
just create an object of the inner class there. Thats it!
When we compile the java class ( OuterClass ) which has a inner class ( InnerClass ) , two class files are created :
1. OuterClass.class
2. OuterClass$InnerClass.class
Comments