大佬們幫看下
public class HelloWorld {
? ? public static void main(String[] args) {
char today='日';
switch(today){
? ? case '日':
? ? ? ? System.out.println("吃主席套餐");
? ? ? ? break;
? ? case '一':
? ? ? case'三':
? ? ? case'五':
? System.out.println("包子");
? ? ? ? ? ? break;
? ? ? ? ? ? case'二':
? ? ? ? ? ? ? ? case'四':
? ? ? ? ? ? ? ? ? ? case'六':
? ? ? System.out.println("油條");
? ? ? ? ? ? ? ? break;
}
? ? ? ??
? ? ? ??
? ? }}
? ? ? ??
? ? ? ??
? ? ? ? 寫的對吧?這個網頁上提示錯誤;
在Ec上卻提示對的
2019-09-23
public?class?HelloWorld?{ ????public?static?void?main(String[]?args)?{ ????????char?today='日'; ????????switch(today){ ????????????case?'一': ????????????case?'三': ????????????case?'五':??? ????????????????System.out.println("吃包子"); ????????????????break; ????????????case'二': ????????????case'四': ????????????case'六': ????????????????System.out.println("吃油條"); ????????????????break; ????????????case'日': ????????????????System.out.println("吃主席套餐"); ????????????????break; ????????}2019-09-23
你的縮進有問題????
2019-09-23
public class HelloWorld {
? ? public static void main(String[] args) {
????????char today='日';
????????switch(today){
? ? case '日':
? ? ? ? System.out.println("吃主席套餐");
? ? ? ? break;
? ? case '一':
? ? case'三':
? ? case'五':
? ? ???? System.out.println("包子");
? ? ? ? break;
? ? case'二':
? ? case'四':
? ? case'六':
? ? ???? System.out.println("油條");
? ? break;
? ? }? ??
}
? ??
}
2019-09-23
public?class?HelloWorld?{????public?static?void?main(String[]?args)?{ char?today='日'; switch(today){ ???? case?'日': ????????System.out.println("吃主席套餐"); ????????break; ????case?'一': ????case'三': ????case'五': ???? System.out.println("包子"); ????????break; ????case'二': ????case'四': ????case'六': ???? System.out.println("油條"); ???? break; ????}???? }????}