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

Enumeration and Iterator, Which One Has Better Performance in Jav ...

How Will You Handle InterruptedException in Java ?

What are the Lifecycle Methods of a JSP ?

What are the Differences Between a Vector and an ArrayList in Jav ...

Why Do You Use Upcasting or Downcasting in Java ?