Java OCA OCP Practice Question 336

Question

Which of the following are true about an unreachable object?

  • A. It will be garbage collected.
  • B. Its finalize() method will be invoked.
  • C. It can become reachable again.
  • D. It has a null value.


C.

Note

There's no guarantee that an unreachable object will be garbage collected.

There's no guarantee that an unreachable object's finalize() method will be invoked.

An unreachable object can become reachable again.

This can happen if the object makes itself accessible to other reachable objects when its finalize() method is invoked.

There is no restriction that requires an unreachable object to have a null value.




PreviousNext

Related