YearMonth isAfter(YearMonth other) example

Description

YearMonth isAfter(YearMonth other) check if this year-month is after the specified year-month.

Syntax

isAfter has the following syntax.


public boolean isAfter(YearMonth other)

Example

The following example shows how to use isAfter.


import java.time.YearMonth;
/*from   w w  w. ja va  2  s  .co  m*/
public class Main {
  public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    System.out.println(y.isAfter(YearMonth.now()));

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset