Month isSupported() method in Java
The isSupported() method is a built-in method of the Month ENUM which is used to check if the specified field is supported or not. This method accepts a fields as a parameter and returns true or false based on whether the field is supported or not.
public boolean isSupported(TemporalField field)
Parameters: This method accepts a single parameter field, which is to be checked if it is supported or not.
Return Value: This method returns a boolean value True if the field is supported otherwise it returns False.
Below programs illustrate the above method:
This field is supported!
This field is not supported!
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.