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




Latest Courses