java中switch的case可以写两个参数吗比如case 3||4

switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;

可以以这种形式合并同类。

猜你喜欢

转载自blog.csdn.net/qq_41438541/article/details/88768656