Question: Create a new Java project. 1. Create a new class named CompareStrings. 2. Write an application that uses String method compareTo to compare strings. 3.
Create a new Java project.
1. Create a new class named CompareStrings.
2. Write an application that uses String method compareTo to compare strings.
3. Create three Strings as follows:
1) The tuna is gone
2) The tuna is missing
3) The tuna is gone
4. Compare String 1 to String 2.
The output should be:
Compare result:
The tuna is gone < The tuna is missing
5. Compare String 1 to String 3.
The output should be:
Compare result:
The tuna is gone == The tuna is gone
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
