Question: Consider the following method, smallest, which is intended to return the smallest of three integers. It does not always work as intended. public static int
Consider the following method, smallest, which is intended to return the smallest of three integers. It does not always work as intended.
public static int smallestint x int y int z
if x y && x z
return x;
else if y x && y z
return y;
else
return z;
Which of the following identifies the condition in which smallest may not work as intended?
A smallest always returns the value of z
B smallest may not work correctly when z has the smallest value.
C smallest may not work correctly when x and y have equal values.
D smallest may not work correctly when x and z have equal values.
E smallest may not work correctly when y and z have equal values.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
