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

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!