Answer Posted / ranganathkini
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 Java's garbage collector, the responsibility of cleaning
up that native allocations falls on the object's
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 Java's GC. Hence it is an
invaluable feature.
But it needs to be used with caution as finalization
consumes more processing by Java
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
How to disable caching on back button of the browser?
What is meant by object?
What is map in java?
Write the algorithm to check the number non-leaf nodes in a tree.
What initialize variables?
How do you know if a value is nan?
What is the return type of the main method?
Why string objects are immutable in java?
Can a top level class be private or protected?
What do you know about the garbate collector?
What's the default access specifier for variables and methods of a class?
What is the difference between sop and work instruction?
What is the order of arraylist in java?
How do you remove all elements from an arraylist in java?
What is keyset in java?