What method can compare three integers? compareTo?

63 views Asked by At

Can compareTo compare 3 integers? Reason I am asking is because I need to have a method that compares the month, day, and year to see if they are equal.

1

There are 1 answers

0
Makoto On

No, the traditional definition of compareTo only takes one argument - the object you're comparing against.

You should use an object that encapsulates the month, day, and year - that should be what you pass to your compareTo method instead of the raw values.