The finalize() method will always be invoked once before the object is garbagecollected. However, the finalize() method might never be invoked for an object in itslifetime, because there is no guarantee that it will get garbage collected.Then what is the use of the finalize() method? Why should we use it?

Showing Answers 1 - 1 of 1 Answers

chkalyane

  • Jul 6th, 2009
 

Finalize method is used to clean up the  unmanaged code. when we use the finalize method that object reference will be placed into the finalize queue. so whenever the memory required the GC will lookinto the finalize queue and corresponding object will be freed.

  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.

 

Related Answered Questions

 

Related Open Questions