What is the disadvantage of:
for(int i=0;i<10;i++)
{
String str = ""+i;
System.out.println(str);
}
over:
String str;
for(int i=0;i<10;i++)
{
str = ""+i;
System.out.println(str);
}
and:
for(int i=0;i<10;i++)
{
StringBuilder strBld = new StringBuilder("Hello"+i);
System.out.println(strBld.toString());
}
With respect to total number of object created in memory?