YearMonth isSupported(TemporalField field) example

Description

YearMonth isSupported(TemporalField field) checks if the specified field is supported.

Syntax

isSupported has the following syntax.


public boolean isSupported(TemporalField field)

Example

The following example shows how to use isSupported.


import java.time.YearMonth;
import java.time.temporal.ChronoField;
/*from   w  ww  .  j  ava  2  s .  co m*/
public class Main {
  public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    boolean m = y.isSupported(ChronoField.YEAR);
    System.out.println(m);

  }
}

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