Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ / SELF - CHECK PROBLEMS: / / Note: you may need to put some of your answers inside comments / / 2 1 .
SELFCHECK PROBLEMS:
Note: you may need to put some of your answers inside comments
Consider the following variable declarations:
Integer n;
Integer n;
Integer n;
String s "computer";
String s "soda";
String s "pencil";
Indicate whether the result of each of the following comparisons is positive,
negative, or :
A:
ncompareTon
B:
ncompareTon
C:
ncompareTon
D:
scompareTos
E:
scompareTos
F:
scompareTos
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started