Question: Consider the following variable declarations: Integer n1 = 15; Integer n2 = 7; Integer n3 = 15; String s1 = computer; String s2 = soda;
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)
Step by Step Solution
3.36 Rating (159 Votes )
There are 3 Steps involved in it
a n1compareTon2 0 b n3... View full answer
Get step-by-step solutions from verified subject matter experts
