Karen, Your are not on the right track.
For problems like this , as in the previous post , represent all objects & references pictorially.
What
you should do is draw a circle in a paper for each object created and make pointers to it, when ever you are assigining a variable to a object. Strike of that pointer when any object goes out of scope or when any variable is set to null.
An object is said to be eligible for GC when it soesnt have any pointers.
Integer aa = new Integer(1);
//1 to my undertanding, aa can be collected here
Integer bb = new Integer(2);
No aa cannot be collected. Because the scope off aa still exists even after the line where you created the bb object.
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified