Tuesday 5 June 2018

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


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

MonthDemo.java

import java.time.Month;

public class MonthDemo
{
    public static void main(String[] args)
    {
        Month month = Month.of(6);
        System.out.println("month = "+month);
       
        /*
         * Returns:
         *
         * the first month of the quarter corresponding to this month,
         * not null
         */

        Month firstMonthOfQuarter = month.firstMonthOfQuarter();
        System.out.println("firstMonthOfQuarter = "+firstMonthOfQuarter);
    }

}

Output

month = JUNE
firstMonthOfQuarter = APRIL

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8781cb2c398cca3734b090d3a80e4b0023df3f71/BasicJava_2018/MonthDemo_firstMonthOfQuarter/?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