java.time.MonthDay isAfter()方法

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

1 语法

public boolean isAfter(MonthDay other)

2 参数

other:比较的其他月份日,不能为null。

3 返回值

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

4 示例 

package com.yiidian;

/**
 * 一点教程网: http://www.yiidian.com
 */
/**
 * java.time.MonthDay isAfter()方法
 */
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

 

热门文章

优秀文章