哪措了 看不出來啊 求大神幫幫忙
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; ????????default?: ????????System.out.println("吃主席套餐"); ?}??? ?} }
2016-02-16
沒有錯(cuò)的,我復(fù)制了你的程序,可以得出結(jié)果,文件名一定要和類名一樣。
2016-02-16
package com.kccc;
import java.util.Scanner;
public class HelloWorld {
?
???? public static void main(String[] args) {
??Scanner imput = new Scanner(System.in);
??System.out.println("請(qǐng)輸入今天星期幾:");
???? ?char today= imput.next().charAt(0);
???????? switch(today){
??case '一':?
???? case '三':???
???? case '五':???
???? System.out.println("吃包子");???
???? break;???
???? case '二':???
???? case '四':??
???? case '六':???
???? System.out.println("吃油條");???
???? break;?????
???? case '日':???
???? System.out.println("吃主席套餐");??????????
????? }??
??}
?}
2016-02-16
沒錯(cuò)啊