Wednesday, 14 March 2018

How to use isSupported method of Year Class which accepts TemporalField


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

ZoneOffsetDemo.java

import java.time.ZoneOffset;
import java.time.temporal.ChronoField;

public class ZoneOffsetDemo
{

    public static void main(String[] args)
    {

        ZoneOffset zoneOffset = ZoneOffset.UTC;
        System.out.println("zoneOffset = "+zoneOffset);

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

        boolean result = zoneOffset.isSupported(ChronoField.OFFSET_SECONDS);
        System.out.println(result);
    }

}

Output

zoneOffset = Z
true

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/dc7c5f1cf2584c5bc7f3eb33e62ff414965c0d6f/BasicJava_2018/ZoneOffsetDemo_isSupported/?at=master

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

    Post a Comment