PRACTICE / UNDERSTAND / REPEAT

Java practice question

Practice objects & references with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

1 questionAnswers explainedFree · no login

Try this question

Objects & references · MCQQuestion link ↗

What happens to an object when one reference to it is set to null?

Choose one answer
Answer & explanation

Answer: It is collectible only if no relevant reachable references remain

Garbage collection is based on reachability, not one variable assignment.