Question: when jvm runs garbage collector?
Answer: When JVM don't have necessary memory space to run, garbage collector will run and delete unnecessary objects and allocate memory for JVM. Unnecessary objects are the objects which have no reference (address) for it. There are mainly 4 points for objects to eligible for garbage collector.