ublic static void mathMethod(int x)Which of the following method calls are legal?a. mathMethod(x);b. mathMethod(y);c. mathMethod(x, y);d. mathMethod(x + y);e. mathMethod(12L);f. mathMethod(12);g. mathMethod(12.2);h. mathMethod();i. mathMethod(a);j. mathMethod(a / x);

Respuesta :

ijeggs

Answer:

Legal calls to the method mathMethod(int x) are

a. mathMethod(x);

b. mathMethod(y)

d. mathMethod(x + y);

f. mathMethod(12)

i. mathMethod(a);

j. mathMethod(a / x);

Explanation:

If the variables x,y and a have been declared as ints then those method calls are legal since in the declaration of the method, mathMethod(int x)  it is to accept an argument of type int when it is called. Note that in option j, the integer division a/x will still yield an int.