My previous post launched a three-part series on the java.lang.Object class and its methods. After introducing Object, I examined clone() and equals(). In this post, I dig deeper into Object by covering the finalize(), getClass(), and hashCode() methods.
Finalization
Q: What does the finalize() method accomplish?
A: The finalize() method lets an object that overrides this method, and which is known as a finalizer, perform cleanup tasks (such as releasing system resources) when called by the garbage collector. This cleanup activity is known as finalization. The default finalize() method does nothing; it returns when called.