posted 22 years ago
Hi Shobha,
line 2 is a part of main method, and q1 is object holding variable declared within main method,(Q q1=null). now total objects created within 'for' loop are 10. right. however only the last object created (when i==9) will be referenced by (and stored in,roughly speaking) q1. object created from i==0 to 1==8 (i.e 9) will be eligible for GC, as we have not been 'saving' them any where.