java – Calendar. Before (object when), why object?

From Javadoc's calendar before(Object when):

Returns whether this calendar represents the time before the time represented by the specified object This method is equivalent to:

compareTo(when) < 0

If and only if the calendar is a calendar instance Otherwise, the method returns false

If someone passes something that is not a calendar instance and returns false, why does it accept object? Why not accept calendar instances? This allows me to observe the incorrect results of the function for a period of time

Solution

I don't think there's any special reason java. util. Calendar has some design problems that we have to live with, unfortunately

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>