Ask Question
17 October, 00:16

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)

+1
Answers (1)
  1. 17 October, 03:41
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers