Java Calendar compareTo() MethodThe compareTo() method of Calendar class compares the time values (millisecond offsets) between two calendar object. SyntaxParameteranotherCalendar - the Calendar object to be compared. ReturnsReturns an integer value either 0 , 1 or -1 ThrowsNullPointerException - if the specified Calendar is null. IllegalArgumentException - if the time value of the specified Calendar object can't be obtained Example 1Test it NowOutput: The result is :1 Example 2Test it NowOutput: The result is :-1 Example 3Test it NowOutput: The result is :0
Next TopicJava Calendar Class
|