Question: Using the scanner class, read in three strings as input. Using the compareTo() method of the String class as well as decisions, decide which string

Using the scanner class, read in three strings as input. Using the compareTo() method of the String class as well as decisions, decide which string would come lexicographically (alphabetically) first.

In java please!

Using the scanner class, read in three strings as input. Using the

Using the scanner class, read in three strings as input. Using the compareTo() method of the String class as well as decisions, decide which string would come lexicographically (alphabetically) first. INPUT Three Strings: - String a - String b - String c PROCESSING The compareTo() method of the String class compares two strings and returns a positive or negative value depending on which String is lexicographically first. If the two Strings are equal, then 0 is returned. "A".compareTo("B") will return 1, since " A " is one letter before " B " "C".compareTo("A") will return +2 since " C " is two letters after " A " "Ice cream".compareTo("Ice cream") will return 0 , since they are lexographically the same *Note: For this question you do not have to implement a test for two strings being lexicographically the same. You are guaranteed the input strings will be unique. Remember that order of comparison matters for your result. OUTPUT whatever string is first lexicographically

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!