Consider the following variable declarations: Integer n1 = 15; Integer n2 = 7; Integer n3 = 15;

Question:

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)

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: