Page 1243 - AP Computer Science A, 7th edition
P. 1243
27. (C) Ordering of strings involves a character-by-character comparison starting with the leftmost character of each string. T hus , strA prec edes strB (s inc e “A” prec edes “a”) or strA.compareTo(strB) < 0. This eliminates choices B and D. Eliminate choices A and E since strB precedes strC (because “C” precedes “c”) and therefore strB.compareTo(strC) < 0. Note that string1.compareTo(string2) == 0 if and only if string1 and string2 are equal strings.