The Object class provides a callback method, finalize() , that may be invoked on an object when it becomes garbage. Object ‘s implementation of finalize() does nothing—you can override finalize() to do cleanup, such as freeing resources.
The Object class provides a callback method, finalize() , that may be invoked on an object when it becomes garbage. Object ‘s implementation of finalize() does nothing—you can override finalize() to do cleanup, such as freeing resources.