哪里錯了啊,我用的if語句去打這個
public class HelloWorld {
? ? public static void main(String[]args) {
char today='日';
? ? ? ? if(today.equals("一,三,五") ){
? ? ? ? ? ? System.out.println("吃包子");
? ? ? ? }?
? ? ? ? else if(today.equals("二,四,六")){
? ? ? ? ? ? System.out.println("吃油條");
? ? ? ? }
else{
? ? System.out.println("吃主席套餐"); ??
}
? ? }
}
? ? ? ??
2016-02-23
public class HelloWorld {
??? public static void main(String[]args) {
?? ??? ?char today='日';
??????? if(today.equals("一,三,五") ){
??????????? System.out.println("吃包子");
??????? } else if(today.equals("二,四,六")){
??????????? System.out.println("吃油條");
??????? }else{
?? ??? ? System.out.println("吃主席套餐");? ?
?? ??? ?}
??? }
}
? 這樣把else往上提一格試試行不行呢?
2016-02-23
雙引號改成單引號,char后面的字符用的單引號
2016-02-21
咳咳?
你的?System.out.println("吃主席套餐"); ?
這句中 ?; ?是用的中文輸入法的 ?所以要轉換啊
2016-02-21
不能調用基本類型 char 的 equals(String)