DateFormat equals() Method in Java with Examples
The equals() Method of the DateFormat class is used to compare two DateFormat objects. The method returns True if this DateFormat is equal to the passed object else returns False.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public boolean equals(Object obj)
Parameters: The method takes one parameter obj of Object type and refers to the object that is to be compared with this DateFormat object.
Return Value: The method returns boolean True if both the objects are equal else the method returns False.
Below programs illustrate the working of equals() Method of DateFormat:
First: Mar 27, 2019 Second: Mar 27, 2019 Equality: true
First: Mar 27, 2019 Second: 11:04:25 AM Equality: false