Finalization
Java technology allows you to use the finalize() method to do the necessary cleanup before the garbage collector removes the object from memory.
Finalization page 3 of 5
Java technology allows you to use the finalize() method to do the necessary cleanup before the garbage collector removes the object from memory. This method is called by the garbage collector on an object when garbage collection determines that there are no more references to the object. It is defined in the Object class, thus it is inherited by all classes. A subclass overrides the finalize() method to dispose of system resources or to perform other cleanup: