compareTo() definition mistake?


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.

Updated on: 30-Jul-2019

107 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements