Nested and Inner Classes
Nested and inner classes are often considered too confusing for beginners. However, they have some merits that make them a proper discussion topic in this book. To name a few, you can hide an implementation completely using a nested class and it provides a shorter way of writing an event-listener.
This chapter starts by defining what nested classes and inner classes are and continues by explaining types of nested classes.
Let’s start by learning the correct definitions of nested and inner classes. A nested class is a class declared within the body of another class or interface. There are two types of nested classes: static and non-static. Non-static nested classes are ...