1. static nested class
2. inner (non-static) nested class
3. local class
4. anonymous class
A static nested class is just like a normal Java class. If it is public, it can be accessed or used to create objects just like any other class.
A non-static inner class requires an object of the containing class.
A local class is declared within and scoped to a block.
An anonymous class is defined in place after the new operator without assigning any name to it. It’s a way to pass functions as parameters.