Inner Classes
To allow listeners for multiple buttons, we use Inner Classes. These are classes within classes. For example:
Here the classes myButtonListener and myOtherButtonListener (which define listener objects) are embedded within the class
EventHandlerExample. We've created 2 buttons, each with its own listener class.
EventHandlerExample. We've created 2 buttons, each with its own listener class.