Hey
java ppl
This one is from JQuest .
pls read the following code
1. public void countDown() {
2. for( int i = 10 ; i >= 0 ; i-- ){
3.
String tmp = Integer.toString( i );
4. System.out.println( tmp );
5. }
6. System.out.println("BOOM!");
7. }
When the program reaches line 6, how many of the String objects created in line 3 are eligible for
garbage collection? "Assume that the System.out object is not keeping a reference."
my answer is 11 but author says 10 can somebody explian how??(it print 0-10 , 11 objects )
I think if System.out is not keeping the object then it also has lost refernce to last object which makes it 11 ??
Regards Denish