Recall that you can write many different classes in one source file. You can also write a class inside of another class.
Why in the world would you want to do that? Well, they sort of allow you to scope your classes. The inner class becomes a member of the outer class. That is, the inner class acts as a member of the outer class, just like its methods and fields.
Important thing: Objects in an inner class have access to even the private variables in instances of the outer class.
You typically use an inner class to define a helper—that is, a class with a very specific purpose. In GUI development, you need to create listeners that handle events such as mouse clicks. Often, these events are handled using inner classes.