When is an Object Subject to Garbage Collection
An object is subject to garbage collection when it becomes unreachable to the program in which it is used. In Java, an object becomes eligible for garbage collection when there are no more references to it. The Java Virtual Machine (JVM) has a garbage collector that automatically identifies and removes objects that are no longer … Read more