import java.util.Scanner;
public static void year(){
//创建月份数组
byte month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
System.out.print("please impot year:");
//声明Scanner对象,获取键盘输入值
Scanner str = new Scanner(System.in);
int year = str.nextInt();
//判断:可以被4整除并且不能被100整除的为闰年
if (year % 4 == 0 && year % 100 != 0) {
month[1] = 29;
System.out.println("此年是闰年!");
} else
System.out.println("此年不是闰年");
//遍历输出结果
for (int i = 0; i < month.length; i++) {
System.out.println(i + "year is " +month[i] + "day\t");
}
//关闭输入流,释放内存
str.close();
}