How Can You Make an Object Eligible for Garbage Collection in Java ?

To make an Object eligible for Garbage collection, just make sure that it is unreachable to the program in which it is currently defined / created / used. You can set the object reference to null and make sure no other object refers it. Once the object cannot be reached, Garbage Collection can clean it during the next run.



You May Interest

How Can You Upload a Large File in JSP ?

What are the Different Types of Events Provided by Spring Framewo ...

Java How To Find The Average Of 10 Numbers Using A While Loop

What are the Different States of a Thread in Java ?

What is the Difference Between Queue and Stack Data Structures in ...