Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / SELF - CHECK PROBLEMS: / / Note: you may need to put some of your answers inside comments / / 2 1 .

// SELF-CHECK PROBLEMS:
// Note: you may need to put some of your answers inside comments
//21. Consider the following variable declarations:
// Integer n1=15;
// Integer n2=7;
// Integer n3=15;
// String s1= "computer";
// String s2= "soda";
// String s3= "pencil";
// Indicate whether the result of each of the following comparisons is positive,
// negative, or 0:
// A:
// n1.compareTo(n2)
// B:
// n3.compareTo(n1)
// C:
// n2.compareTo(n1)
// D:
// s1.compareTo(s2)
// E:
// s3.compareTo(s1)
// F:
// s2.compareTo(s2)
//22.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: Tyler Durden
// Type a name: Marla Singer
// Marla Singer goes before Tyler Durden
//23.Write code to read a line of input from the user and print the words of
// that line in sorted order, without removing duplicates. For example, the
// program output might look like the following:
// Type a message to sort: to be or not to be that is the question
// Your message sorted: be be is not or question that the to to
// EXERCISES:
// None
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Focus on the interview.

Answered: 1 week ago

Question

=+which it operates?

Answered: 1 week ago

Question

=+How should we organize a book to maximize learning and interest

Answered: 1 week ago