Ask Question

Suppose that you have created a program with only the following variables.

int x = 2

int y = 3

Suppose that you also have a method with the following header: public static void mathMethod (int x) Which of the following method calls are legal?

a. mathMethod (x); mathMethod (12)

b. mathMethod (y); g. mathMethod (12.2)

c. mathMethod (x, y); mathMethod (

d. mathMethod (x + y); mathMethod (a)

e. mathMethod (12L); mathMethod (a / w)

+5
Answers (1)
  1. 2 September, 14:44
    0
    Complete Question:

    Suppose that you have created a program with only the following variables.

    int x = 2

    int y = 3

    Suppose that you also have a method with the following header: public 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 / w

    Answer:

    The following options are legal

    A mathMethod (x);

    B mathMethod (y);

    D mathMethod (x + y);

    F mathMethod (12)

    Explanation:

    The method mathMethod (int x) Can only receive an int as argument when called.

    The four options above provides an int variable to the method call. The other options do not provide an int variable.

    E provides a long variable type

    G provides a double variable type

    H has a syntax error

    I the variable a is not defined

    J Both a and w are not defined
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Suppose that you have created a program with only the following variables. int x = 2 int y = 3 Suppose that you also have a method with the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers