我有代码,其中switch语句测试的内容取决于数组变量:
String shuff = Import.shuffle();
String[] form = new String[95];
for(int i = 0; i < 95; i++)
{
form[i] = Format.shuffle(shuff, i);
}
switch(str)
{
case"a":
x = 6;
break;
case"b":
x = 16;
break;
case"c":
x = 23;
break;
//So on and so forth
}
我要做的是采用数组形式[],并将其用作案例:
String shuff = Import.shuffle();
String[] form = new String[95];
for(int i = 0; i < 95; i++)
{
form[i] = Format.shuffle(shuff, i);
}
switch(str)
{
case form[0]:
x = 6;
break;
case form[1]:
x = 16;
break;