It is possible to define a class within another class such classes are known as nested classes.
There are two types of nested classes static is explained in Creating Static Methods In Java Using Static Keyword and non static.