Hi Friends,
How many of
String object created in line 5 are eligible for garbage collection at line 8?
1public void A()
2{
3 for(int i=0; i <=10 ; i++)
4 {
5 Sting str=Integer.toString(i);
6 System.out.println(str);
7 }
8 System.out.println("Ready for garbage collection");
}
Answer written is 10.
I think it should be 11. Any Comments?
"The self-controlled soul, who moves amongst sense objects, free from either attachment or repulsion, he wins eternal Peace." - Bhagavad Gita