java.time.YearMonth.isLeapYear() 方法
描述
java.time.YearMonth.isLeapYear() 方法根据 ISO 预测日历系统规则检查年份是否为闰年。
声明
以下是 java.time.YearMonth.isLeapYear() 方法的声明。
public boolean isLeapYear()
返回值
如果年份是闰年,则为 true,否则为 false。
示例
下面的例子展示了 java.time.YearMonth.isLeapYear() 方法的使用。
package com.tutorialspoint;
import java.time.YearMonth;
public class YearMonthDemo {
public static void main(String[] args) {
YearMonth date = YearMonth.of(2016,12);
System.out.println(date.isLeapYear());
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
true

