Check leap year in java

Java code to check whether a given year in leap year or not

import java.io.*;

class Test {
     public static void main(String[] args) throws IOException {
          int year;
          System.out.println("Enter the year");
          BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
          year=Integer.parseInt(br.readLine());
          if(((year%4==0)&&(year%100!=0))||(year%400==0))
              System.out.println(year+" is a leap year");
          else
              System.out.println(year+" is not a leap year");
     }
}

No comments: