Suppose I have a lot of String Variables(100 for example):
String str1 = \"abc\";
String str2 = \"123\";
String str3 = \"aaa\";
....
String st
Yes. The way to use a loop is not to declare 100 string variables. Use one array instead.
String[] str = new String[101];
str[1] = "abc";
str[2] = "123";
str[3] = "aaa";
....
str[100] = "zzz";
(I made the indexes go from 1 to 100 to show how it corresponds to your original code, but it's more normal to go from 0 to 99 instead, and to initialize it with an array initializer as in @markspace's answer.)