Solved

The Method Below Is Designed to Print the Smaller of Two

Question 40

Multiple Choice

The method below is designed to print the smaller of two values received as arguments. Select the correct expression to complete the method. public void showSmaller(Comparable value1, Comparable value2)
{
If ( _________________________ )
System.out.println(value1 + " is smaller.") ;
Else
System.out.println(value2 + " is smaller.") ;
}


A) value1 < value2
B) value1.compareTo(value2) > 0
C) value1.compareTo(value2) == 0
D) value1.compareTo(value2) < 0

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions