This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Question 13 of chap 17 of K&B is: Which statement is true? ... C. If an object can be accessed from a live thread, it can't be garbage collected. ... (other answers not relevant) The answer is obviously C... but is that statement actually true? The book explains breifly strong, soft, weak, and phantom refrences, saying that only strong refrences are not garbage collected at some point, but if you have a weak refrence to an object, you have access to the object, but it can be garbage collected, proving the true statement false. Is my logic correct? (I know this is not on the exam, but you cant say the statement is true if it isn't)
Miles, Here is my take on it. The book states that unless told explicitly otherwise, accessibility and/or refrence usually refer(s) to strong references. As objects with strong references cannot be collected, the answer is correct. The book also states that you do not need to know the advanced management model for the exam, so at least in the context of the exam, the question and answer are correct.
Originally posted by Sanjay Gandham: The book also states that you do not need to know the advanced management model for the exam...
Exactly. Although there is a model for advanced reference control, you need not know it for the SCJP exam. Within the context of the exam, you can assume that any reference is a "strong" reference. Corey