Java Date compareTo() MethodThe compareTo() method of Java Date class compares two dates and sort them for order. This method is specified by compareTo in interface Comparable<Date>. Syntax:ParametersanotherDate - a date to be compared Return
ExceptionNullPointerException will be thrown if anotherDate is null. Example 1Test it NowOutput: Your comparison value is : -1 Example 2Test it NowOutput: Your comparision value is : 0 Example 3Test it NowOutput: Your comparison value is : 1 Next Topicjava.util.Date |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India