wxxx_
2016-02-24 16:22
public class wsq {
public static void main(String[] args) {
char today='日';
switch (today){
case ('一'|'五'|'三'):
System.out.println("包子");
break;
case ('二'|'四'|'六'):
System.out.println("油条");
break;
default:
System.out.println("吃主席套餐");
}
}
}
换成这样就可以了,,不知为什么
Case 后面只能为常量
不能这样的 你只能多写几个case 不能在case 后面用||
case后面接常量,而且只能是一个
Java入门第一季(IDEA工具)升级版
1167352 学习 · 18630 问题
相似问题