Welcome Guest | Sign in | Register
Garbage Collections - Discussion Page For Q.2816 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Garbage Collections > Questions and Answers

Exercise:

Section 1

Q: Which statement is true?
A. Calling Runtime.gc() will cause eligible objects to be garbage collected. B. The garbage collector uses a mark and sweep algorithm.
C. If an object can be accessed from a live thread, it can't be garbage collected. D. If object 1 refers to object 2, then object 2 can't be garbage collected.

Answer and Explanation

Answer:If an object can be accessed from a live thread, it can't be garbage collected.

Explanation:
This is a great way to think about when objects can be garbage collected.
Option A and B assume guarantees that the garbage collector never makes.
Option D is wrong because of the now famous islands of isolation scenario.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.