当我尝试在旧的 java 机器上编译它时出现此错误。我需要切换到 if 语句?有人可以阐明这一点以切换到 if 语句吗?我收到这个错误
发现不兼容的类型
:需要 java.lang.String
:int
这是代码
switch(name) {
String label;
Rotor(){;}
Rotor(String name){
switch(name){
case "B":
conversion_chart = B;
break;
case "C":
conversion_chart = C;
break;
case "I":
conversion_chart=I;
notch = NOTCH[0];
break;
case "II":
conversion_chart=II;
notch = NOTCH[1];
break;
case "III":
conversion_chart=III;
notch = NOTCH[2];
break;
case "IV":
conversion_chart=IV;
notch = NOTCH[3];
break;
case "V":
conversion_chart=V;
notch = NOTCH[4];
break;
case "VI":
conversion_chart=VI;
notch = NOTCH[5];
break;
case "VII":
notch = NOTCH[6];
conversion_chart=VII;
break;
case "VIII":
notch = NOTCH[7];
conversion_chart=VIII;
break;
}
label = name;
position = 0;
}