Example

public class ClassA extends Applet {
private Button b;

public void finalize () throws Throwable {
b.removeActionListener(listener)
}
}


Solution
Avoid removing EventListeners inside of a finalize method. This prevents the listener from being being collected by the garbage collector.