How many times may an object's finalize() method be invoked by thegarbage collector

An object's finalize() method may only be invoked once by the garbage collector.

Showing Answers 1 - 2 of 2 Answers

Tharani devi

  • Oct 8th, 2005
 

finalize method of an object is executed only once.

  Was this answer useful?  Yes

Subhash

  • Jul 31st, 2007
 

What if in the finalize method I make the object reachable.

<code>
class a
{
        b b1=null;
        ..
}

class b
{
        a a1=null;
        b(a a2)  //a2 is reachable
        {
            a1 = a2;
        }
        finalize
       {
                a1.b =this; //now "this" also reachable

      }
}
</code>

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.