JVM uses heap to put all the objects. Garbage Collection removes an object from heap to free space when there is no live references to the object.