Ask Question
4 June, 04:24

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);

+4
Answers (1)
  1. 4 June, 07:10
    0
    Option a, b, d, f, and j is legal method calls.

    Explanation:

    In the given question some information is missing, that is the method definition which can be described as follows:

    Method definition:

    int x = 2, y=3; / /defining integer variable

    int mathMethod (int x) / /method definition

    {//method body

    int z=x+y; / /calculate value

    return z; / /return value

    }

    In the given question option a, b, d, f, and j is legal, because these options follow the correct syntax, and other option were incorrect which can be defined as follows:

    In option c, It is illegal because it accepts only one parameter. In option e, It is accepts long number, that's why it is illegal. In option g, It accepts float value, that's why it is illegal. In option h, It doesn't accepts any parameter. In option i, It isn't use in method.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Which of the following method calls are legal? a. mathMethod (x); b. mathMethod (y); c. mathMethod (x, y); d. mathMethod (x + y); e. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers