boolean isLeap(long year)
描述 (Description)
根据ISO proleptic日历系统规则, java.time.YearMonth.isLeap()方法检查年份是否为闰年。
声明 (Declaration)
以下是java.time.YearMonth.isLeap()方法的声明。
public static boolean isLeap(int year)
参数 (Parameters)
year - 检查闰年。
返回值 (Return Value)
如果年份是飞跃则为true,否则为false。
例子 (Example)
以下示例显示了java.time.YearMonth.isLeapYear()方法的用法。
package com.iowiki;
import java.time.YearMonth;
public class YearMonthDemo {
public static void main(String[] args) {
System.out.println(YearMonth.isLeap(2016));
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
true