Thursday, 7 June 2018

How to use isSupported(TemporalField field) method of Month Enum | Java 8 Date and Time


Click here to watch on Youtube: 
https://www.youtube.com/watch?v=DC8ilObdSSs&list=UUhwKlOVR041tngjerWxVccw

MonthDemo.java

import java.time.Month;
import java.time.temporal.ChronoField;

public class MonthDemo
{
    public static void main(String[] args)
    {

        Month month = Month.of(3);

        /*
         * Parameters:
         *
         * field - the field to check, null returns false
         *
         * Returns:
         *
         * true if the field is supported on this month-of-year, false
         * if not

        boolean isSupported = month.isSupported(ChronoField.MONTH_OF_YEAR);
        System.out.println(isSupported);
    }

}
 

Output

true

Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/MonthDemo_isSupported.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/MonthDemo_isSupported

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/21e60817517fc375c595b23163eb96a6fc305b37/BasicJava_2018/MonthDemo_isSupported/?at=master

See also:

  • All JavaEE Videos Playlist
  • All JavaEE Videos
  • All JAVA EE Links
  • Spring Tutorial
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • Cooking Tutorial
  • No comments:

    Post a Comment