Here is the answer opf your question,
Java language is an object oriented language that is also platform independent. There are different methods for the finalization in java. It's not only Java technology helps you to use the finalize method to do the required cleanup before the garbage collector eliminates the object from memory. This method is known as the garbage collector on an object when garbage determines that there are no additional objects. It is hereditary by all classes. It's the subclass which overrides the finalize method to destroy of system resources and perform other clean up functions.