Click here to watch on Youtube:
https://www.youtube.com/watch?v=lwV1Si8EDVg&list=UUhwKlOVR041tngjerWxVccw
YearMonthDemo.java
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/YearMonthDemo_isLeapYear.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/YearMonthDemo_isLeapYear
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/YearMonthDemo_isLeapYear/?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 
Cooking Tutorial 
https://www.youtube.com/watch?v=lwV1Si8EDVg&list=UUhwKlOVR041tngjerWxVccw
YearMonthDemo.java
import java.time.YearMonth;
public class YearMonthDemo
{
public static void main(String[] args)
{
YearMonth yearMonth = YearMonth.of(2016, 03);
System.out.println(yearMonth);
/*
* Returns:
*
* true if the year is leap, false otherwise
*/
boolean isLeapYear = yearMonth.isLeapYear();
System.out.println("is " + yearMonth.getYear()
+ " Leap year? = " + isLeapYear);
System.out.println("------------------------");
yearMonth = YearMonth.of(2017, 03);
System.out.println(yearMonth);
isLeapYear = yearMonth.isLeapYear();
System.out.println("is " + yearMonth.getYear()
+ " Leap year? = " + isLeapYear);
}
}
Output
public class YearMonthDemo
{
public static void main(String[] args)
{
YearMonth yearMonth = YearMonth.of(2016, 03);
System.out.println(yearMonth);
/*
* Returns:
*
* true if the year is leap, false otherwise
*/
boolean isLeapYear = yearMonth.isLeapYear();
System.out.println("is " + yearMonth.getYear()
+ " Leap year? = " + isLeapYear);
System.out.println("------------------------");
yearMonth = YearMonth.of(2017, 03);
System.out.println(yearMonth);
isLeapYear = yearMonth.isLeapYear();
System.out.println("is " + yearMonth.getYear()
+ " Leap year? = " + isLeapYear);
}
}
2016-03
is 2016 Leap year? = true
------------------------
2017-03
is 2017 Leap year? = false
is 2016 Leap year? = true
------------------------
2017-03
is 2017 Leap year? = false
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/YearMonthDemo_isLeapYear.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/YearMonthDemo_isLeapYear
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/YearMonthDemo_isLeapYear/?at=master
See also:
 


 
No comments:
Post a Comment