Originally posted by sharan vasandani:
hi,
suppose a object is to be garbage collected and so its finalize method is running in which "m not passing any references of that object anywhere else"
in that is it guaranteed that the object will be garbage collected after the finalize method is run.
or is there any possibility that even after running finalize method for an object that garbage collector might not collect it.
important :- am not passing references to that object from finalize method.
the jvm takes care of the garbage collection. it implements garbage collection by calling the finalize methods on the respective Objects.
so if a finalize method is called upon an object, the space occupied by the object is freed and returned to the heap... it is gauranted...
however it is up to the jvm to decide when to garbage collect or when not to or even say to call finalize method on which object...if it finds any references it stops the finalize method of that objectand proceeds further without interrupting the garbage collection procedure...ok....
got the answer.. if you still have any doubts .... check this linkout..
java world