Monday, February 25, 2013

If an object becomes eligible for Garbage Collection and its finalize() method has been called and inside this method the object becomes accessible by a live thread of execution and is not garbage collected. Later at some point the same object becomes eligible for Garbage collection, will the finalize() method be called again?


Nice question. Isn't it? :)

I urge you to think about this for a moment before hurrying to the answer.

.
.
.
finalize() will run only once. Repeat with me, finalize() will run only once! So, the answer to above question is No.


No comments: