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--;
}
}