Skip to content
Sharp

Memory Management · interview question

How does Java handle memory for objects that are no longer reachable from any references?

Multiple choiceHardchapter-14-curatedpremiummemory-managementstack-vs-heap
Choose one answer
Answer and explanation

Correct answer

B. Garbage collector reclaims the memory.

Why

In Java, the garbage collector is responsible for reclaiming memory occupied by objects that are no longer reachable from any references. This automatic memory management helps prevent memory leaks and ensures efficient use of memory resources.

Test yourself on Memory Management

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

Start free test
All Memory Management questions →