June 2018
Beginner
722 pages
18h 47m
English
We have already used the int compareTo(String anotherString) method in our examples. It returns the difference between the positions of this String value and the value of anotherString in an ordered list. It is used for the natural ordering of strings since it is an implementation of the Comparable interface.
The method int compareToIgnoreCase(String str) performs the same function but ignores the case of the compared strings and is not used for natural ordering because it is not an implementation of the Comparable interface.
Read now
Unlock full access