A Java Virtual Machine may provide mechanisms whereby classes are unloaded. The details of such mechanisms are not specified in this version of the Java Language Specification. In general, groups of related class and interface types will be unloaded together. This can be used, for example, to unload a group of related types that have been loaded using a particular class loader. Such a group might consist of all the classes implementing a single applet in a Java-based browser such as HotJava, for example.
A class may not be unloaded while any instance of it is still reachable (§12.6). A class or interface may not be unloaded while the Class
object that represents it is still reachable.
Classes that declare class finalizers (§12.7) will have these finalizers run before they are unloaded.