Sunday, August 29, 2010

Object can be collected even if it has a valid reference, if no live thread has access to the object; objects reside in the heap; and the finalize method can send an object reference to another object, thereby saving the otherwise doomed object

Courtesy of Sun Web Learning Center

Which two are true? (Choose two.)


A Java applications can run out of memory.
B An object that has a valid reference cannot be garbage collected.
C The purpose of garbage collection is to delete objects from the stack.
D Objects created within inner classes can become eligible for garbage collection.
E If an object's finalize method runs to completion, the object will always be garbage collected.

A and D are correct. An object can be collected even if it has a valid reference, if no live thread has access to the object; objects reside in the heap; and the finalize method can send an object reference to another object, thereby saving the otherwise doomed object.

No comments:

Post a Comment