//从键盘输入年份存放到变量year中
Scanner scanner=new Scanner(System.in);
int year=scanner.nextInt();
//用if-else结构判断year中的年份是否为闰年
if(year%4==0 &&year % 100!=0 || year % 400==0) {
System.out.println("year"+ year+"is a leap year.");
}else {
System.out.println("year"+year+"is not a leap year.");
}