Nested Inner Class Points
1.Inner class is a class that is define inside a class that is used to managed class code. 2.Using Inner class we can make it private ,public ,protected , static ,default ,final ,abstract etc. 3.Using inner class we can remove class confliction. 4.Using inner class we can remove time complexity. 5.Using inner class an inner class private data can access from another inner class with same outer class. 6.Outer class private data can be access from inner class. 7.There are four types of inner class: i)Non static inner class ii)Static inner class iii)local inner class iv)Anonymous Inner class i)Non static inner class: 1.Non static inner class define inside a class and out side a method without using static keyword. 2.Non static inner class can be access through outer reference. 3.Non static inner class is not shareable. 4.you can define Interface inside a class , class inside an interface ,Iterface inside interface and class inside a class. 5.Only we can define constant variable as a static except of no property as a static we can define. 6.Non static inner class can never have an interface. 7.Non static inner class can have any kind of Modifiers.ii)Static inner class:
1.static inner class define inside a class and out side a method with using static keyword. 2.It is used for shareable. 3.It can be access from outer class name. 4.we can define non static property inside static inner class. 5.we can define an interface inside static inner class.iii)local inner class:
1.It is also called temporary class. 2.It can be define inside method or constructor. 3.It can never make private ,protected ,public , static and default. 4.It can never have an interface. 5.It can be final or abstract only. 6.we can call it from with in the same method.iv)Anonymous Inner class
1. Annonymous inner class is a class that has no name. 2. Annonymous inner class generated at runtime. 3. Annonymous inner class we can create instance of an interface an abstract class and a normal class also. 4.we can pass Anonymous inner class as an arguments.
No comments:
Post a Comment