Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
finalize() method will be invoked just before an object is marked for garbage collection. The reason could be that the existing object may not have a valid reference or if it is not pointing to anything. Also you can never be sure about whether an object will be garbage collected or not. You can only predict that how many of them are going to be garbage collected. It is taken care by the JVM internally.
20th Mar 2020, 7:56 AM
Avinesh
Avinesh - avatar