This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Objects created in the example are 4 i.e. one referenced by c1 and short in c1 & the other one by c2 and short in c2. c3 is just a refernce variable having null value. As c1 is assigned null value, only the object which is referenced by c1 and short in c1 are eligible for GC. c2 is still referring to the object which was created in line 2. So it is not eligiible for GC.
Remember copy of variable c2 is passed to the method c2!
one thing : you have missed closing brace for the method go()! [ September 30, 2008: Message edited by: M SRILATHA ]
Also check on the Errata for the book. The Short is created by autoboxing, and based on the value (and due to the cache), it isn't eligible for GC. In the corrected version, the short has a larger value.