/*从键盘输入一个年份,判断是否是闰年*/
2 import java.util.*;
3 public class J2_12{
4 public static void main(String args[]){
5 Scanner scanner = new Scanner(System.in); /*构造一个Scanner对象,其传入参数为System.in*/
6 System.out.println("Please enter a year!");
7 int year= scanner.nextInt(); /*读取一个int数值 */
8 if(year % 4==0 && year % 100 !=0|| year % 400==0) /*判断是否为闰年*/
9 System.out.println(+year+" IS A LEAP YEAR");
10 else
11 System.out.println(+year+" IS NOT A LEAP YEAR");
12 }
13 }