This tip suggests designing supporting classes as top-level nested classes inside the primary class. This approach makes the coupling between the primary and the supporting classes clear and leads to an implementation that is easier to understand, use, and maintain. Some of these classes and interfaces are meaningful only in the context of other classes or interfaces. Furthermore, the use of nested classes makes the collaboration easier to recognize, avoids namespace pollution, and reduces the number of source files.
Nested classes are simply static inner classes.
Because of this, inner class objects require an object of the enclosing class, while nested class objects do not. In addition, nested classes have access to all members of the enclosing class. Event objects encapsulate change notifications from the model. Views register interest in various events by adding listeners to the underlying model of the component. The model notifies its viewers of changes in its own state by delivering these event objects to its registered listeners.