Let's see an example.
You see this code and think it's right, but it turns out that the one that compares whether the dates are the same is wrong. Let's look at another example:
The two dates are the same, but the objects are different and that is what is being compared, not the dates but the objects.
Let's see an example of how to compare:
The getTime() method
Then comparing the identical number value gives us true.