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 a Filter in JSP ?

What are the Differences Between Internal and External Iterator i ...

How Can We Prevent Busy Waiting in Java ?

What are the Uses of Optional in Java ?

What is the Main Difference Between a Session and Cookie in JSP ?