- java.time 包类
- java.time - 主页
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time 包枚举
- java.time - Month
- java.time 实用资源
- java.time - 论坛
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
打印页面