Can someone explain the result for this Q please?.
Here is a method which creates a number of
String objects in the course of printing a
series of messages.
1)public void SoundOff() {
2) for(int i = 0; i < 10; i++) {
3) String tmp = Integer.toString(i);
4) System.out.print(tmp + ",");
5) }
6) System.out.println("10");
7)}
When the program reaches line 6,how many of the String objects created in line 3 are eligible for garbage collection?Assume that
System.out object is not keeping a reference.
a) none
b) 1
c) 8
d) 9