June 2025
Intermediate to advanced
1129 pages
53h
English
“Utility is part of the beauty.”—Albrecht Dürer (1471–1528)
Java allows you to define a type declaration within another type declaration, creating a nested type . In this chapter you’ll learn about nested types and how to use them.
So far, you’ve learned about classes, interfaces enumerations, and records that were declared either alone in the file or together with other types in a file (i.e., a compilation unit). In addition, however, you can include a type declaration in another type declaration. This option makes sense when the motivation is to hide even more details, for instance, local type declarations that don’t need more visibility.
This same principle applies for ...
Read now
Unlock full access