java.time.MonthDay.isAfter(MonthDay other)方法

java.time.MonthDay.isAfter(MonthDay other)方法检查此月-日是否在指定的月-日之后。

声明

以下是java.time.MonthDay.isAfter(MonthDay other)方法的声明。

public boolean isAfter(MonthDay other)

参数

  • other - 比较的其他月份日,不能为null

返回值

如果此月-日在指定的月-日之后,则为true

示例

以下示例显示了java.time.MonthDay.isAfter(MonthDay other)方法的用法。

package com.zaixian;

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.isAfter(date));  
   }
}

编译并运行上面的程序,这将产生以下结果 -

false

上一篇: java.time.MonthDay类 下一篇: java.time.OffsetDateTime类