Question: Use the compareTo method to write code that reads two names from the console and prints the one that comes first in alphabetical order. For

Use the compareTo method to write code that reads two names from the console and prints the one that comes first in alphabetical order. For example, the programs output might look like the following:

Type a name: Taylor Smith

Type a name: Marie Singer

Marie Singer goes before Taylor Smith

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!