- 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
列印頁面