Nested, Inner, Outer, static, non static classes in Java

A class inside a class is known as nested class. By default a nested class has access to the members of outer class; however, the outer class does not have access to the members of the nested class. Nested class could be static or non static. If it is static it cannot access members of the outer class. Inner classes are actually non static nested classes. It could access the members of outer class. However, the outer class cannot access members of inner class.


class Oclass {

body of outer class;

class Iclass {

body of inner class;



Leave a Reply