Monday 5 February 2018

How to use of methods of MonthDay Class | Java 8 Date and Time


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

MonthDayDemo.java

import java.time.Month;
import java.time.MonthDay;

public class MonthDayDemo
{

    public static void main(String[] args)
    {

        /*
         * Parameters:
         *
         * month - the month-of-year to represent, from 1 (January) to
         * 12 (December)
         *
         * dayOfMonth - the day-of-month to represent, from 1 to
         * 31Returns:the month-day, not null
         */

        MonthDay monthDay1 = MonthDay.of(9, 30);
        System.out.println(monthDay1);

        /*
         *
         * Parameters:
         *
         * month - the month-of-year to represent, not null
         *
         * dayOfMonth - the day-of-month to represent, from 1 to 31
         *
         * Returns:the month-day, not null
         */

        MonthDay monthDay2 = MonthDay.of(Month.JULY, 30);
        System.out.println(monthDay2);
    }

}

Output

--09-30
--07-30

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/MonthDayDemo_of.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MonthDayDemo_of

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ad2ec4eea34d56bd8669882cbae785d53f2cb8b9/BasicJava/MonthDayDemo_of/?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
  • No comments:

    Post a Comment