-2
我有3种类型的数组的: ControlType
ControlName
ControlValue
如何使用功能/ SWITCH CASE语句方法在Java中
当控制类型是“ClickButton”,我必须通过相应的控件名称和ControlValue 。
代码:
public class StringSwitchDemo extends StringSwitchDemoHelper
{
public static int getMonthNumber(String ControlType) {
int ControlValue = 0;
int ControlName = 0;
if (ControlType == null) {
return ControlValue;
}
switch (ControlType.toString()) {
case ClickButton:
return ControlType(ControlValue, ControlName);
break;
}
return ControlValue;
}
private static int ControlType(String controlValue, String controlName) {
// TODO Auto-generated method stub
return 0;
}
}
你不需要(也不能在'return'后面加上'break',因为它是无法访问的。 “break”永远不会被打中,因为方法已经返回。 – khelwood
'ClickButton'是编译时常量字符串吗? – khelwood
@khelwood新用户似乎只问问题而不回答!!!! –