Click here to watch on Youtube: 
https://www.youtube.com/watch?v=Mj6Xdd83fPc&list=UUhwKlOVR041tngjerWxVccw
YearMonthDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/YearMonthDemo_isValidDay.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/YearMonthDemo_isValidDay
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/YearMonthDemo_isValidDay/?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=Mj6Xdd83fPc&list=UUhwKlOVR041tngjerWxVccw
YearMonthDemo.java
import java.time.YearMonth;
public class YearMonthDemo
{
public static void main(String[] args)
{
YearMonth yearMonth = YearMonth.of(2017,2);
System.out.println("yearMonth = "+yearMonth);
/*
* Parameters:
*
* dayOfMonth - the day-of-month to validate, from 1 to 31,
* invalid value returns false
*
* Returns:
*
* true if the day is valid for this year-month
*/
boolean isValidDay = yearMonth.isValidDay(12);
System.out.println("Day 12 isValidDay = "+isValidDay);
isValidDay = yearMonth.isValidDay(31);
System.out.println("Day 31 isValidDay = "+isValidDay);
}
}
public class YearMonthDemo
{
public static void main(String[] args)
{
YearMonth yearMonth = YearMonth.of(2017,2);
System.out.println("yearMonth = "+yearMonth);
/*
* Parameters:
*
* dayOfMonth - the day-of-month to validate, from 1 to 31,
* invalid value returns false
*
* Returns:
*
* true if the day is valid for this year-month
*/
boolean isValidDay = yearMonth.isValidDay(12);
System.out.println("Day 12 isValidDay = "+isValidDay);
isValidDay = yearMonth.isValidDay(31);
System.out.println("Day 31 isValidDay = "+isValidDay);
}
}
Output
yearMonth = 2017-02
Day 12 isValidDay = true
Day 31 isValidDay = false
Day 12 isValidDay = true
Day 31 isValidDay = false
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/YearMonthDemo_isValidDay.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/YearMonthDemo_isValidDay
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/YearMonthDemo_isValidDay/?at=master
See also:
 


 
No comments:
Post a Comment