Home / Java Programming / Garbage Collections :: Discussion

Discussion :: Garbage Collections

  1. Which statement is true?

  2. A.
    All objects that are eligible for garbage collection will be garbage collected by the garbage collector.
    B.
    Objects with at least one reference will never be garbage collected.
    C.
    Objects from a class with the finalize() method overridden will never be garbage collected.
    D.
    Objects instantiated within anonymous inner classes are placed in the garbage collectible heap.

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    All objects are placed in the garbage collectible heap.

    Option A is incorrect because the garbage collector makes no guarantees.

    Option B is incorrect because islands of isolated objects can exist.

    Option C is incorrect because finalize() has no such mystical powers.


Be The First To Comment