O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Nested and Inner Classes

The main driving force for this change in the language was a major change in the way user interface events are handled. In Java 1, user interface events could be delivered only to classes in the user interface hierarchy. As Java applications got larger, this method became slow and inflexible.

Starting with Java 1.1, events can be delivered to any object, but this implies great duplication of code in every class that needs to handle an event. Nested classes are the solution to avoiding this duplication of code and simplifying the process of adding an event handler to a class.

Nested classes have proven to be very useful for providing specialized behavior in many areas of the Java standard library. Although nested classes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required