Skip to content
Sharp

Garbage Collection · interview question

How does Java's HotSpot VM determine if an object is unreachable?

Multiple choiceMediumchapter-14-curatedpremiumgarbage-collectiongenerational-gc
Choose one answer
Answer and explanation

Correct answer

B. By using a reachability analysis from the root set.

Why

The HotSpot VM uses a reachability analysis from the root set of references to determine if an object is unreachable. If an object cannot be reached by any reference path, it is considered unreachable.

Test yourself on Garbage Collection

A free test with instant, explained results. No account needed.

Start free test
All Garbage Collection questions →