Java判断某年是否为闰年

public class Dm2{
public static void main(String[] args){
/*

  • 闰年 : 能被400整除的一定是闰年
  • 能被4整除的,但是不能被100整除的也是闰年
  • 其他的不是
  • 100 200 300不是闰年
  • 400是闰年
    */
    int year=2012;
    if(year%400==0 || (year%4==0 && year%100!=0)){
    System.out.println(“the year “+year+” is a leap year.”);
    }else
    System.out.println(“the year “+year+” is not a leap year.”);
    }
    }
0%