Chapter 7. Nested Classes And Interfaces

Exam Objectives

  • Write code to construct instances of any concrete class, including normal top-level classes and nested classes.

Supplementary Objectives

  • State the kinds of nested classes and interfaces that can be defined.

  • Identify the context in which a nested class or interface can be defined.

  • State which accessibility modifiers are allowed for each category of nested classes.

  • State which nested classes create instances that are associated with instances of the enclosing context.

  • State the access rules that govern accessing entities in the enclosing context of nested classes, and write code that uses the augmented syntax involving the this keyword for this purpose.

  • State whether a definition of a nested class can contain static and non-static members.

  • Write code to instantiate nested classes, using the augmented syntax of the new operator.

  • Write code to show how nested classes can be imported and used.

  • Distinguish between the inheritance hierarchy and the enclosing context of any nested class or interface.

  • Write code to implement anonymous classes by extending an existing class or by implementing an interface.