CompareWords reads two words and prints how Java compares them: their lengths, equals, equalsIgnoreCase, compareTo, compareToIgnoreCase, whether the first comes before the second in the dictionary, and the first letter of each with its character code.
For the input
apple Banana
the program prints
Lengths: 5 and 6
Same length: false
equals: false
equalsIgnoreCase: false
compareTo: 31
compareToIgnoreCase: -1
apple comes before Banana in the dictionary: true
First letters: a (97) and B (66)
Never compare strings with ==. What does the sign of compareTo tell you?