This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.