🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: JVM Memory and Garbage Collection: all 10 questions

Quiz: JVM Memory and Garbage Collection · Question 4 of 10

When does an object become eligible for garbage collection?

When does an object become eligible for garbage collection?

  1. A.When its reference count becomes zero
  2. B.When no chain of references from a GC root can reach it
  3. C.When System.gc() is called
  4. D.When the method that created it is called again
Answer & explanation

Correct answer: When no chain of references from a GC root can reach it

The JVM traces from roots (locals, statics, live threads). Unreachable objects are garbage, even if they reference each other.

Can you get the rest right without peeking?

Take the timed Quiz: JVM Memory and Garbage Collection quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →