Hi,
This is from javacamp mock exam.
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.
will have been garbage collected?(Assume that the System.out object is not keeping a reference.)
A. none
B. There is no way to tell
C. 9
D. 10
E. 11
I selected the option e but it was incorrect. Moreover the answers were not listed. what is the answer and why?
-Sanjana