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

How Will You Handle InterruptedException in Java ?

Why Java Provides Garbage Collector ?

Why Java Does Not Support Operator Overloading ?

How Will You Make an Object Immutable in Java ?

What is the Difference Between pass by reference and pass by valu ...