Any class can have an optional finalizer that will perform any necessary clean-up needed when garbage collector (which is automatic in Java) tries to delete object and free-up resources it uses |
An example is given for an object that uses an I/O stream and needs to close it on termination |
protected void finalize() {
|
} |
Earlier one might have set this up with syntax such as that on next foil |