I (think I) understand why I get a compile error (Illegal Start of Expression) at the tmpString = {"",...} line in this method (--> tmpString is immutable, though it does not have a problem with the tmpBase line before), but what is the cleanest way to fix this - perhaps another variable type? Thank you.
public static ArrayList<String> myMethod(String tmpWord, int tmpNum)
{
ArrayList<String> tmpReturn = new ArrayList<String>();
String tmpBase = tmpWord.substring(0,tmpWord.length()-2);
String[] tmpString = {"a","a","g","g","ya"};
switch(tmpNum)
{
case 1: tmpBase = "xx";
break;
case 2: tmpBase = "yy";
break;
case 3:
break;
default:
{
tmpBase = "-";
tmpString = {"","","","",""};
break;
}
}
for (int j=0; j<5; j++)
tmpReturn.add( (tmpBase + tmpString[j]) );
return tmpReturn;
}