Click here to watch on Youtube :
https://www.youtube.com/watch?v=ERSb3DLZbv0&list=UUhwKlOVR041tngjerWxVccw
import java.time.LocalDate;
import java.time.MonthDay;
public class MonthDayDemo
{
public static void main(String[] args)
{
MonthDay monthDay = MonthDay.now();
System.out.println(monthDay);
/*
* Parameters:
*
* year - the year to use, from MIN_YEAR to MAX_YEAR
*
* Returns:
*
* the local date formed from this month-day and the
* specified year, not null
*/
LocalDate localDate = monthDay.atYear(2013);
System.out.println(localDate);
}
}
import java.time.MonthDay;
public class MonthDayDemo
{
public static void main(String[] args)
{
MonthDay monthDay = MonthDay.now();
System.out.println(monthDay);
/*
* Parameters:
*
* year - the year to use, from MIN_YEAR to MAX_YEAR
*
* Returns:
*
* the local date formed from this month-day and the
* specified year, not null
*/
LocalDate localDate = monthDay.atYear(2013);
System.out.println(localDate);
}
}
Output
--01-18
2013-01-18
2013-01-18
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/MonthDayDemo_atYear.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MonthDayDemo_atYear
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8fa516d67356209c67bf6743dfb7e718c4c9e5f6/BasicJava/MonthDayDemo_atYear/?at=master
See also:
No comments:
Post a Comment