QUESTION IMAGE
Question
question 42
1 pts
given the following method header, which of these method calls is incorrect?
public void displayvalue(double x, int y);
displayvalue(a, b); // where a is a long and b is a byte
displayvalue(a, b); // where a is an int and b is a byte
displayvalue(a, b); // where a is a short and b is a long
all of these would give an error.
The method displayValue expects a double and an int as parameters. In the first option, a long cannot be directly passed as a double without an explicit conversion, and in the third option, a long cannot be passed as an int without an explicit conversion. In the second option, an int can be passed as an int and a byte can be promoted to an int automatically.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
A. displayValue(a, b); // where a is a long and b is a byte
C. displayValue(a, b); // where a is a short and b is a long
D. All of these would give an error.