When Does JVM Call the Finalize Method in Java ?

JVM instructs the Garbage Collector to call the finalize method, just before releasing an object from the memory. A programmer can implement finalize() method to explicitly release the resources held by the object. This will help in better memory management and avoid any memory leaks.



You May Interest

What is the Difference Between a Set and a Map in Java ?

What is an Output Comment in JSP ?

What is Externalizable Interface in Java ?

What is the Difference Between remove Methods of Collection and I ...

How Stack and Heap Work in Java Multi-threading Environment ?