Java Calendar equals() Method
The equals() method compares two objects for equality and returns true if they are equal. The equals() method is provided in the Object class. As object class is the super class of all other classes in java. Calendar class inherits the equals() method. It compares this (current calendar object) calendar to the specified Object. The result is true if and only if the argument is a Calendar object of the same calendar system that represents the same time value under the same Calendar parameters as this object.
Object : Object to be compared
It returns a Boolean value.
Do not throw any exception.
Example 1Test it Now
Wed Aug 01 02:31:56 PDT 2018 Wed Aug 01 02:31:57 PDT 2018 Cal1 and Cal2 are equal:false
Example 2Test it Now
Wed Aug 01 02:34:20 PDT 2018 Wed Aug 01 02:34:20 PDT 2018 Cal1 and Cal2 are equal:true
Example 3Test it Now
Wed Aug 01 02:36:22 PDT 2018 Wed Aug 01 02:36:22 PDT 2018 Cal1 and Cal2 are equal:false