Click here to watch on Youtube :
https://www.youtube.com/watch?v=t1WGcWYWMUE&list=UUhwKlOVR041tngjerWxVccw
MonthDayDemo.java
import java.time.MonthDay;
public class MonthDayDemo
{
public static void main(String[] args)
{
MonthDay monthDay1 = MonthDay.parse("--12-30");
MonthDay monthDay2 = MonthDay.parse("--02-20");
/*
* Parameters:
*
* other - the other month-day to compare to, not null
*
* Returns:
*
* true if this is after the specified month-day
*/
System.out.println(monthDay1.isAfter(monthDay2));
/*
* Parameters:
*
* other - the other month-day to compare to, not null
*
* Returns:
*
* true if this point is before the specified month-day
*/
System.out.println(monthDay1.isBefore(monthDay2));
/*
* Parameters:
*
* obj - the object to check, null returns false
*
* Returns:
*
* true if this is equal to the other month-day
*
*/
System.out.println(monthDay1.equals(monthDay2));
}
}
public class MonthDayDemo
{
public static void main(String[] args)
{
MonthDay monthDay1 = MonthDay.parse("--12-30");
MonthDay monthDay2 = MonthDay.parse("--02-20");
/*
* Parameters:
*
* other - the other month-day to compare to, not null
*
* Returns:
*
* true if this is after the specified month-day
*/
System.out.println(monthDay1.isAfter(monthDay2));
/*
* Parameters:
*
* other - the other month-day to compare to, not null
*
* Returns:
*
* true if this point is before the specified month-day
*/
System.out.println(monthDay1.isBefore(monthDay2));
/*
* Parameters:
*
* obj - the object to check, null returns false
*
* Returns:
*
* true if this is equal to the other month-day
*
*/
System.out.println(monthDay1.equals(monthDay2));
}
}
Output
true
false
false
false
false
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/MonthDayDemo_isAfter_before.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MonthDayDemo_isAfter_before
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/1e56a5b0ee03d5726eaa59561253516c29bd898c/BasicJava/MonthDayDemo_isAfter_before/?at=master
See also:
No comments:
Post a Comment