Java Date Time - Year isSupported(TemporalField field) example








Year 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.Year;
import java.time.temporal.ChronoField;
// w w  w. j a  v a2 s . c om
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    
    System.out.println(y.isSupported(ChronoField.YEAR));

  }
}

The code above generates the following result.