What are the differences between static or non-static inner classes?
• There is no such thing as a static inner class. There are top-level classes and nested classes, and nested classes are by definition divided into static and inner. • If it is static, it is not inner class, you can use it just as top-level class, but put a qualifier as EncloseingClass.EnclosedClass. • If inner class is a member of enclosing class, it must be attached to an instance of the Enclosing class, something like new EnclosingClass().new EnclosedClass(). • Local and anonymous classes are also inner classes, they can be defined in methods, initializers, which will be local to that enclosing scope. • Since the scope can be instance or static, Local and anonymous classes can be defined in an instance or a static context. • Attention: JLS2 has got rid of “Nested top-level class” confusing terminology now. The correct name now is static member class, which in contrary to inner class (non-static member class) in JLS2 now. • See more in Classes in JLS2 • See an Inner/Nested/Local Clas