[Solved] java how compare function works

The Comparable interface is used to compare two objects and their order. As per the Javadocs, the compareTo method should return 0 if the two objects are equal, any negative number if this object is “smaller” than the specified other, and any positive number if this object is “larger” than the specified other. What “smaller” … Read more