The isSupported(TemporalField) method of YearMonth class is used to check if the specified field is supported by YearMonth class or not means using this method we can check if this YearMonth object can be queried for the specified field.
The supported fields of ChronoField are:
All other ChronoField instances will return false.
public boolean isSupported(TemporalField field)
Parameters: This method accepts only one parameter field which represents the field to check.
Return Value: This method returns the boolean value true if the field is supported on this YearMonth, false if not.
Below programs illustrate the isSupported(TemporalField) method:
YearMonth :2017-08 PROLEPTIC_MONTH Field is supported by YearMonth class: true
YearMonth :2017-08 HOUR_OF_DAY Field is supported by YearMonth class: false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.