Hi , 1) If in finalize method we make re refrence to the object .Will that object ever be garbage collected. 2) Is it mandatory to call the base class finalize method in the subclass's finalize method else the compiler will give compile time error .
ms , welcome to javaranch. PROPER NAMES ARE NOW REQUIRED
Please Refer to the official naming policy of javaranch. You will have to reregister yourself with proper first & last name & help maintain the decorum of the forum. Waiting for your new posts with proper first & last name
Thanks a lot Vaidraj , Actually I read these two questions in one mock test and it was said that that first time the object will not be garbage collected but second time the GC will ignore finalize and the object will be garbage collected .I could not understand the logic .
Yes ms You it is true that finalize() will called only once on an object. If your creating a new Instance by using this() in finalize(),that means you r again creating the instance of this type but second time finalize() won't be called. And also if there is not any refrence which is pointing to the newely object created , it will be again grabage collected.So All the objects which r not represented by any variables are eligible for GC