Question : Here is a method that crates a number of
String objects in the course of printing a sequence:
1.public void countDown()
2.{
3.for (int i=10;1>=0;i--)
4.{
5.String tmp = Integer.toString(i);
6.System.out.println(tmp);
7.}
8.System.out.println("BOOM!");
9.}
When the program reaches line 8 , how many of the String objects created in line 5 are
eligible for garbage collection?(Assume that the System.out object is not keeping a reference.
The answer given in the book is 10 .
I have a doubt over it . I think it should be 11.
Please help.