Thursday 7 June 2018

How to use minLength() and maxLength() methods of Month Enum


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

MonthDemo.java

import java.time.Month;

public class MonthDemo
{
    public static void main(String[] args)
    {
        Month month = Month.FEBRUARY;
        System.out.println("month = " + month);
       
        /*
         * Returns:the minimum length of this month in days, from 28
         * to 31
         */

        System.out.println("min length = " + month.minLength());

        /*
         * Returns:the maximum length of this month in days, from 29
         * to 31
         */

        System.out.println("max length = " + month.maxLength());
    }

}

Output

month = FEBRUARY
min length = 28
max length = 29

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/21e60817517fc375c595b23163eb96a6fc305b37/BasicJava_2018/MonthDemo_min_max/?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