Possible Duplicate:
Difference between declaring variables before or in loop?
String str;
for (int i = 0; i < 10; i++) {
str = "Hello, World"; // Is str created only 1 time?
}
What is difference between above and below? And if they are different, which one is better?
for (int i = 0; i < 10; i++) {
String str = "Hello, World"; // Is str created 10 times?
}