Friday 8 June 2018

Java 8 DayOfWeek Enum Introduction | Java 8 Date and Time | Java Date and Time


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

Click the below Image to Enlarge:
Java 8 DayOfWeek Enum Introduction | Java 8 Date and Time | Java Date and Time

Java 8 DayOfWeek Enum Introduction | Java 8 Date and Time | Java Date and Time

DayOfWeekDemo.java

import java.time.DayOfWeek;

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

        DayOfWeek dayOfWeek = DayOfWeek.MONDAY;

        /*
         * Returns:the name of this enum constant
         */

        System.out.println("Name = "+dayOfWeek.name());
        /*
         * Returns:the day-of-week, from 1 (Monday) to 7 (Sunday)
         */

        System.out.println("Value = "+dayOfWeek.getValue());
        /*
         * Returns:the ordinal of this enumeration constant
         */

        System.out.println("Ordinal = "+dayOfWeek.ordinal());

    }

}

Output

Name = MONDAY
Value = 1
Ordinal = 0

Refer

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/23d89f367bac9ed4230eafe0abaf49c0a80cc445/BasicJava_2018/DayOfWeekDemo_Intro/?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