Compares two Strings, testing whether one comes before or after the other, or whether they’re equal. The strings are compared character by character, using the ASCII values of the characters. That means, for example, that a comes before b but after A. Numbers come before letters.
myString.compareTo(myString2)
myString: a variable of type StringmyString2: another variable of type Stringa negative number: if myString comes before myString20: if String equals myString2a positive number: if myString comes after myString2