What is inner class?
- An inner class or nested class is a class declared entirely within the body of another class.
- The class that include the inner class is called outer class.
- The inner class can access the methods & var. of outer class but not voice-versa.
- Within the defination of inner class or outer class ,the modifier public & private are equivalents.
- In Java there are 2 types of nested classes:
i) It can defined using the modifier static.
ii) It can’t access the member directly but only through an object.
i) It can access the member of enclosed classes.