package homeWork;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class HomeWork3 {
public static void main(String[] args) throws ParseException {
isRunNian();
}
public static void isRunNian() throws ParseException{
//键盘输入年份
Scanner sc = new Scanner(System.in);
System.out.println("请输入年份:");
int year = sc.nextInt();
//得到2月份之前的毫秒数
SimpleDateFormat date = new SimpleDateFormat("yyy-MM-dd");
Date d1 = date.parse(year+"-2-01");
long time1 = d1.getTime();
//得到3月份之前的毫秒数
Date d2 = date.parse(year+"-3-01");
//得到2月份的天数
long time2 = d2.getTime();
long day = (time2 - time1)/1000/60/60/24;
//判断是否为闰年
if(day==29){
System.out.println(year+"年2月"+day+"天");
System.out.println(year+"是闰年");
}else{
System.out.println(year+"年2月"+day+"天");
System.out.println(year+"不是闰年");
}
}
}