A class that is declared within another class or interface, is called a nested class. Similarly, an interface that is declared within another class or interface, is called a nested interface. A top-level class or a top-level interface is one that is not nested.
In addition to the top-level classes and interfaces, there are four categories of nested classes and one of nested interfaces, defined by the context these classes and interfaces are declared in:
static member classes and interfaces
non-static member classes
The last three categories are collectively known as inner classes. They differ from non-inner classes in one important aspect: that an instance of an inner ...