這個哪里錯了
public class HelloWorld {
? ? public static void main(String[] args) {
char today='日';
switch (today){
? ? case 1、3、5:
? ? ? ? System.out.println("早餐吃包子");
? ? ? ? break;
? ? case 2、4、6:
? ? ? ? System.out.println("早餐吃油條");
? ? ? ? break;
? ? default:
? ? ? ? System.out.println("主席套餐");
}
? ? ? ??
2018-09-28
case后的值類型和switch要一致的,因為程序是從case值和switch值相同處開始執(zhí)行,你這個類型不對
2018-09-27
today 這個變量是char型,你的case是int型,所以不對的呦。改成‘一’‘二’。?!铡@種。