Monday, 4 June 2018

How to use values() method of Month Enum | Java 8 Date and Time | Java Date and Time


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

MonthDemo.java

import java.time.Month;

public class MonthDemo
{
    public static void main(String[] args)
    {
        /*
         * Returns:
         *
         * an array containing the constants of this enum type, in the
         * order they are declared
         */

        Month[] monthArray = Month.values();
        for (Month month : monthArray)
        {
            System.out.println(month);
        }
    }

}

Output

JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/1df932a97e40a15c12e3aa78c6f5eb64823918cb/BasicJava_2018/MonthDemo_values/?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