Static and non-static (inner) classes
- static: member of enclosing class
- no access to members of enclosing class
- can be declared private / public / protected / package private
- inner (non-static):
- have access to other members of the enclosing class (even private)
Usage for:
- logically grouping in one place
- increase encapsulation
- readable and maintainable code
Static nested class:
- just like any other top-level class
Inner class:
- inner class is associated with an INSTANCE of enclosing class
- have direct access to that instance's method and fields
- cannot define any static member of itself (as an associated object with another instance)
- two kinds: local classes / anonymous classes
- shadowing - scope / block....
- inner class serialization 0 strongly discouraged