Chapter Summary


The following information was included in this chapter:

  • categories of nested classes: static member classes and interfaces, non-static member classes, local classes, anonymous classes

  • discussion of salient aspects of nested classes and interfaces:

    • the context in which they can be defined

    • which accessibility modifiers are valid for such classes and interfaces

    • whether an instance of the enclosing context is associated with an instance of the nested class

    • which entities a nested class or interface can access in its enclosing contexts

    • whether both static and non-static members can be defined in a nested class

  • importing and using nested classes and interfaces

  • instantiating non-static member classes using <enclosing object reference>.new syntax

  • accessing members in the enclosing context of inner classes using <enclosing class name>.this syntax

  • accessing members both in the inheritance hierarchy and the enclosing context of nested classes

  • implementing anonymous classes by extending an existing class or by implementing an interface