A draft version of the specification of the language extensions proposed for JDK 1.1
This release of the JavaTM language allows classes to be defined in any scope. In previous releases, Java supported only top-level classes, which must be members of packages. In this release, the programmer can now define inner classes as members of other classes, locally within a block of statements, or (anonymously) within an expression.
The ability to define a class exactly where it is needed makes the coding of adapter classes much simpler and more maintainable. Adapter classes are required by new AWT and Java Beans event handling protocols.
Here are some of the properties that make inner classes useful:
In addition, the programmer can define one top-level class as a static member of another top-level class. Unlike an inner class, a top-level class cannot directly use the instance variables of any other class. The ability to nest classes in this way allows any top-level class to provide a package-like organization for a logically related group of secondary top-level classes.
Inner classes and nested top-level classes are implemented by the compiler, and do not require any changes to the Java Virtual Machine. They do not break source or binary compatibility with existing Java programs.
Please direct comments to innerclass-comments@lukasiewicz.Eng.Sun.COM
The functionality described in this document is subject to review and change. This document makes no committment as to the contents of the 1.1 release of Java, but merely describes features which are proposed for Java 1.1. The content of this document is not yet a standard, and no one should claim compliance to it. Software which uses these features should be considered experimental until JavaSoft commits to inner classes.