question 42\n1 pts\ngiven the following method header, which of these method calls is incorrect?\npublic…

question 42\n1 pts\ngiven the following method header, which of these method calls is incorrect?\npublic void displayvalue(double x, int y);\ndisplayvalue(a, b); // where a is a long and b is a byte\ndisplayvalue(a, b); // where a is an int and b is a byte\ndisplayvalue(a, b); // where a is a short and b is a long\nall of these would give an error.

question 42\n1 pts\ngiven the following method header, which of these method calls is incorrect?\npublic void displayvalue(double x, int y);\ndisplayvalue(a, b); // where a is a long and b is a byte\ndisplayvalue(a, b); // where a is an int and b is a byte\ndisplayvalue(a, b); // where a is a short and b is a long\nall of these would give an error.

Answer

Brief Explanations:

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.

Answer:

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.