根据ISO符号日历系统规则,java.time.YearMonth.isLeapYear()
方法检查年份是否为闰年。
声明
以下是java.time.YearMonth.isLeapYear()
方法的声明。
public boolean isLeapYear()
返回值
如果年份是闰年则返回为true
,否则为false
。
示例
以下示例显示了java.time.YearMonth.isLeapYear()
方法的用法。
package com.yiibai;
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