Check out example codes for "use of nested class in java". It will help you in understanding the concepts better.

Code Example 1

In Java, it is possible to define a class within another class, such 
classes are known as nested classes. They enable you to logically group 
classes that are only used in one place, thus this increases the use of 
encapsulation, and creates more readable and maintainable code.

Learn ReactJs, React Native from akashmittal.com