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
|