What is the purpose of finalisation

Showing Answers 1 - 3 of 3 Answers

suman medisetti

  • Jul 18th, 2005
 

it is amthod used for a object to perform cleanup process before it can be grabage collected

  Was this answer useful?  Yes

Pattukkottai Arun

  • Jul 21st, 2005
 

The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

  Was this answer useful?  Yes

Vijay Kumar

  • Mar 15th, 2013
 

Finalization is a facility provided by Java for classes who
use native resources to clean up before the objects are
garbage collected.

Since native resources or allocations are beyond the control
of Javas garbage collector, the responsibility of cleaning
up that native allocations falls on the objects
finalization code which shud ideally initiate quick clean up
operations and free any native memory it has allocated.

If finalization is not done, then the native resources wud
be left in the memory even after thier related Java
instances have been removed by the Javas GC. Hence it is an
invaluable feature.

But it needs to be used with caution as finalization
consumes more processing by Java

  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