isSupported() method of the MonthDay class used to Check if the specified field is supported by MonthDay class or not means using this method we can check if this MonthDay can be queried for the specified field.
The supported fields of ChronoField are:
- MONTH_OF_YEAR
- YEAR
All other ChronoField instances will return false.
Syntax:
public boolean isSupported(TemporalField field)
Parameters: This method accepts one parameter field which is the field to check.
Return value: This method returns returns boolean value true if the field is supported on this MonthDay, false if not.
Below programs illustrate the isSupported() method:
Program 1:
// Java program to demonstrate // MonthDay.isSupported() method import java.time.*; import java.time.temporal.ChronoField; public class GFG { public static void main(String[] args) { // create a MonthDay object MonthDay month = MonthDay.parse("--10-12"); // apply isSupported() method boolean value = month.isSupported( ChronoField.MONTH_OF_YEAR); // print result System.out.println("MONTH_OF_YEAR Field is supported: " + value); } } |
MONTH_OF_YEAR Field is supported: true
Program 2:
// Java program to demonstrate // MonthDay.isSupported() method import java.time.*; import java.time.temporal.ChronoField; public class GFG { public static void main(String[] args) { // create a MonthDay object MonthDay month = MonthDay.parse("--10-12"); // apply isSupported() method boolean value = month.isSupported( ChronoField.MILLI_OF_SECOND); // print result System.out.println("MiliSecond Field is supported: " + value); } } |
MiliSecond Field is supported: false
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Instant isSupported() method in Java with Examples
- LocalDate isSupported() method in Java with Examples
- LocalTime isSupported() method in Java with Examples
- ZonedDateTime isSupported() method in Java with Examples
- Charset isSupported() method in Java with Examples
- MonthDay with() Method in Java with Examples
- MonthDay from() method in Java with Examples
- MonthDay now() method in Java with Examples
- MonthDay of(int, int) method in Java with Examples
- MonthDay get() method in Java with Examples
- ChronoLocalDateTime isSupported(TemporalUnit) method in Java with Examples
- Year isSupported(TemporalUnit) Method in Java with Examples
- ChronoLocalDateTime isSupported(TemporalField ) method in Java with Examples
- YearMonth isSupported(TemporalField) method in Java with Examples
- ZoneOffset isSupported(TemporalField) method in Java with Examples
- Year isSupported(TemporalField) Method in Java with Examples
- ChronoZonedDateTime isSupported(TemporalUnit) method in Java with Examples
- ChronoZonedDateTime isSupported(TemporalField) method in Java with Examples
- YearMonth isSupported(TemporalUnit) Method in Java with Examples
- MonthDay range() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

