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

Can We Use Thread.sleep Method For Real-time Processing in Java ?

What are the Uses of AOP Module in Spring Framework ?

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

How Can You Determine If Your Program Has a Deadlock in Java ?

How Will You Use Other Java Files of Your Application in JSP Code ...