java.time.MonthDay.isBefore(MonthDay other)
方法检查此月-日是否在指定的月-日之前。
声明
以下是java.time.MonthDay.isBefore(MonthDay other)
方法的声明。
public boolean isBefore(MonthDay other)
参数
other
- 比较的其他月份日,不能为null
。
返回值
如果此月-日在指定的月-日之前,则为true
。
例
以下示例显示了java.time.MonthDay.isBefore(MonthDay other)
方法的用法。
package com.yiibai;
import java.time.MonthDay;
public class MonthDayDemo {
public static void main(String[] args) {
MonthDay date = MonthDay.parse("--12-30");
MonthDay date1 = MonthDay.parse("--12-20");
System.out.println(date1.isBefore(date));
}
}
执行上面示例代码,得到以下结果:
true