Site hosted by Angelfire.com: Build your free website today!
 

The finalize() method

The finalize() method of a class is called before it is garbage collected. The method takes no arguments and must return void, and throws Throwable.

public class SomeObject {
    static int active;
    SomeObject() {
        ...
        active++;
        ....
    }
    public void finalize() {
        active--;
    }
}