← Quiz: JVM Memory and Garbage Collection: all 10 questions
Quiz: JVM Memory and Garbage Collection · Question 7 of 10
What does calling System.gc() do?
What does calling System.gc() do?
- A.It requests a garbage collection, which the JVM may perform or ignore
- B.It always frees all unreachable objects immediately
- C.It deletes all objects, reachable or not
- D.It increases the maximum heap size
Answer & explanation
Correct answer: It requests a garbage collection, which the JVM may perform or ignore
System.gc() is only a hint. The JVM decides when collection actually runs.
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 →