「已注销」
2021-07-26 21:26
采纳率: 66.7%
浏览 73

javaint类型无法转换为布尔类型

求解这个哪里有问题

import java.util.Calendar;

public class Demo1 {
    String weekData="";
    Calendar calendar = Calendar.getInstance();
    int week = calendar.get(Calendar.DAY_OF_WEEK)-1;
    switch (week) {
        case 0:
            weekDate = "星期日";
            break;
        case 1:
            weekDate = "星期一";
            break;
        case 2:
            weekDate = "星期二";
            break;
        case 3:
            weekDate = "星期三";
            break;
        case 4:
            weekDate = "星期四";
            break;
        case 5:
            weekDate = "星期五";
            break;
        case 6:
            weekDate = "星期六";
            break;
    }
    System.out.println("今天是 " + weekDate);
}

}



```!
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题