compareTo() definition mistake?

Java 8Object Oriented ProgrammingProgramming

The example works correctly. The compareTo() method is called by a string object and takes another string object as argument. The return value is integer and is difference in Unicode values of characters of respective strings when they are not equal. The value can be -ve, 0 or +ve.

raja
Published on 01-May-2018 15:23:36
Advertisements