用if语句去打这段程序的话如何去打啊
public class HelloWorld { public static void main(String[] args) { String today = "三"; String[] str1 = { "一", "三", "五" }; String[] str2 = { "二", "四", "六" }; for (String string : str1) { if (today.equals(string)) { System.out.println("吃包子"); } } for (String string : str2) { if (today.equals(string)) { System.out.println("吃油条"); } } if (today.equals("日")) { System.out.println("吃主席套餐"); } } }
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("吃主席套餐");
}
}
}
}