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

What are the Differences Between Comparable and Comparator in Jav ...

Creating a Map with Reverse View and Lookup in Java

What are the Situations in Which You Choose HashSet or TreeSet in ...

Why Do We Use Tag Library in JSP ?

What is the Use of Interceptor Design Pattern in Java ?