java.time.MonthDay.isBefore() 方法示例



说明

java.time.MonthDay.isBefore(MonthDay other) 方法检查此月日是否位于指定月日之前。

声明

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

public boolean isBefore(MonthDay other)

public boolean isBefore(MonthDay other)

参数

other - 与之比较的另一个月日,不能为 null。

返回值

如果此月日早于指定月日,则返回 true。

示例

package com.tutorialspoint;

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
打印页面
© . All rights reserved.