This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hi all, I was reading through the Sun tutorials, and it does say that if all the references to an object are set to null, then the object is eleble for garbage collection. But the following confuses me. Its Question #2, and my question is this, if point is set to null, does that not mean that the object that point refers to is now eligible for garbage collection?
Chad's correct, you must examine the Rectangle class' code. You can see that the reference to the Point instance passed as a parameter is stored in the instance variable origin. So the Rectangle instance holds on to the Point instance preventing it from becoming eligible for garbage collection.