The general contract Comparable.compareTo(o)is to return
- a positive integer if it is larger than another object.
- negative integer if it is less than another.
- 0 if it is equal to another object.
In your example "ab2".compareTo("ac3") == -1, and "ab2".compareTo("ab3") == -1 means only that "ab2"is lower than "ac3"and "ab3". You cannot conclude anything regarding "ac3"and "ab3"only with these examples.
, b c ( "ab2" < "ac3") 2 3 (so "ab2" < "ab3"): Java .