We have two concepts for the finalize() method which is following here:
- For any given object, finalize() will be called only once by the garbage collector.
- Calling finalize() can actually result in saving an object from deletion.
firstly we know that the when we put any code in the normal method we can put this code in the finalized method.We could write code that passes a reference to the object in question back to another object, effectively unintelligible the object for garbage collection.
The garbage collector, however, will remember that, for this object, finalize() already ran, and it will not run finalize() again.