提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
确定年份是否为闰年
public class Main { public static void main(String[] args) {/**时 代 Java - nowjava.com**/ int year = 2004; if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) System.out.println("Year " + year + " is a leap year"); else System.out.println("Year " + year + " is not a leap year"); } }