Home » Java Date equals() Method with Examples

Java Date equals() Method with Examples

by Online Tutorials Library

Java Date equals() Method

The equals() method of Java Date class returns a Boolean value on the basis of compression between two dates for equality. This method overrides equals in class Object

Syntax:

Parameters

obj – an object to be compared

Return

It returns true if the objects are same otherwise false.

Example 1

Test it Now

Output:

Date 'd' equals Date 'd1' : false  

Example 2

Test it Now

Output:

Date 'd' equals Date 'd1' : true  

Next Topicjava.util.Date

You may also like