

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MonthDay isSupported() Method in Java
<p>It can be checked if a ChronoField is supported by the MonthDay class or not by using the isSupported() method in the MonthDay class in Java. This method requires a single parameter i.e. the ChronoField to check. It returns true if the ChronoField is supported by the MonthDay class and false otherwise.</p><p>A program that demonstrates this is given as follows</p><h2>Example</h2><p><a class="demo" href="http://tpcg.io/nnvjfH" rel="nofollow" target="_blank"> Live Demo</a></p><pre class="prettyprint notranslate">import java.time.*; import java.time.temporal.*; public class Demo { public static void main(String[] args) { MonthDay md = MonthDay.now(); System.out.println("The MonthDay is: " + md); boolean flag = md.isSupported(ChronoField.MONTH_OF_YEAR); if(flag) System.out.println("The ChronoField MONTH_OF_YEAR is supported"); else System.out.println("The ChronoField MONTH_OF_YEAR is not supported"); } }</pre><h2>output</h2><pre class="result notranslate">The MonthDay is: --02-21 The ChronoField MONTH_OF_YEAR is supported</pre><p>Now let us understand the above program.</p><p>First the current MonthDay object is displayed. Then the isSupported() method is used to check if the ChronoField MONTH_OF_YEAR is supported by the MonthDay class or not. The returned value is stored in flag and the appropriate response is printed. A code snippet that demonstrates this is as follows:</p><pre class="prettyprint notranslate">MonthDay md = MonthDay.now(); System.out.println("The MonthDay is: " + md); boolean flag = md.isSupported(ChronoField.MONTH_OF_YEAR); if(flag) System.out.println("The ChronoField MONTH_OF_YEAR is supported"); else System.out.println("The ChronoField MONTH_OF_YEAR is not supported");</pre>
- Related Questions & Answers
- Instant isSupported() method in Java
- LocalDateTime isSupported() method in Java
- LocalTime isSupported() method in Java
- MonthDay toString() Method in Java
- MonthDay withMonth() Method in Java
- MonthDay withDayOfMonth() Method in Java
- MonthDay with() Method in Java
- MonthDay query() method in Java
- MonthDay get() method in Java
- MonthDay hashCode() method in Java
- MonthDay range() method in Java
- MonthDay isBefore() Method in Java
- MonthDay isAfter() Method in Java
- MonthDay isValidYear() Method in Java
- MonthDay compareTo() method in Java
Advertisements