Chapter 12. Nested Classes

  • Introduction to Nested Classes

  • Nested Static Classes

  • Inner Member Classes

  • Inner Local Classes

  • Inner Anonymous Classes

  • How Inner Classes Are Compiled

  • The Class Character

  • Exercises

  • Some Light Relief—The Domestic Obfuscated Java Code Non-Competition

This chapter covers all aspects of nested classes. In compiler terminology, nesting means “putting something inside another thing”. Everyone who has read this far will be comfortable with nesting methods and data fields inside classes. In this chapter we explain the different ways a class can be nested inside another class, and what it all means.

Introduction to Nested Classes

Nested classes are another in the (ever-lengthening) list of “Java features ...

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.