Basic theory:
-----------------------------------------------------
About Java Inner classes: an inner class is defined as a class that is defined within another class.
The reason for this exists is:
1. An object of an internal class can access the implementation of the object that created it, including private data. That is, an internal class instance is privileged for an instance of which class contains it.
2. For other classes in the same package, the inner class can be hidden, in other words, the inner class, regardless of the visibility of the method, is even public, except for the containment class, which cannot be used by other classes.
3. Anonymous inner classes can be easily defined as callbacks.
4. The use of internal classes makes it easy to write event drivers.
In fact, its real purpose is simply to define the callback--Further, the event-driven.
Interfaces and callbacks: programming a common pattern is the callback pattern, in which you can specify a method to callback the object when a particular time occurs.