What is the difference between a static and a non-static inner class?
Like static methods and static members are defined in a class, a class can also be static. To specify the static class, prefix the keyword ‘static’ before the keyword ‘class’.
Example :
public static class InnerClass { … }
Differences between static classes and non-static classes:
A static inner class is like other regular classes. They need to be referred by the class name being it is static,
e.g. OuterClass.InnerClass. A static inner class can have access even to the private members of the outer class.
The non-static inner class has the reference that is not visible in the outer class. To utilize the non-static inner class attributes and methods, its instance is to be created in the outer class.