import java.util.Calendar;
import java.util.Date;
public class test19 {
//要求,给定任意一个整数,算出和今天相加后是几月几日,并判断是不是工作日。
public static void main(String args[]) {
Date today = new Date();
long todaytimes = today.getTime();
int day = 5;//假设输入的天数 正负皆可
long theaddtimes = day*24*60*60*1000;
Date getDay = new Date(theaddtimes+todaytimes);
Calendar car = Calendar.getInstance();
car.setTime(getDay);
System.out.println(car.get(Calendar.YEAR)+"年"+(car.get(Calendar.MONTH)+1)+"月"+car.get(Calendar.DAY_OF_MONTH)+"日");
//Calendar.MONTH 第一个月是 JANUARY,它为 0
int weekday = car.get(Calendar.DAY_OF_WEEK);
if(weekday == 1 || weekday == 7){
//SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY 序列是这样的,所有周日为1周六是7
System.out.println("休息日");
}
}
}