As with fields and methods, Java allows classes to be members of other classes.
Java doesn't have to support class nesting. In fact, if you study the Inner Classes Specification document, you will discover workarounds to class nesting. However, there are at least two benefits to Java's support for class nesting:
An improvement in source code clarity
A reduction in name conflicts