Ask Question
1 June, 23:39

Assume that the following method header is for a method in class A. public void displayValue (int value) Assume that the following code segments appear in another method, also in class A. Which contains a legal call to the displayValue method? Select one:a. int x = 7; displayValue (int x); b. int x = 7; displayValue (x) c. int x = 7; void displayValue (x); d. int x = 7; displayValue (x);

+4
Answers (1)
  1. 2 June, 03:05
    0
    d. int x = 7; displayValue (x);

    Explanation:

    Only option D is correct.

    The declaration of the method displayValue () has a single int parameter.

    When this method is called an int value is to passed as an argument terminated with a semi colon as given in option D.

    Option A displayValue (int x); is wrong because it declaring x again at the method call Option B displayValue (x) has a syntax error "Missing semi colon" Option C void displayValue (x); is wrong, when calling a function its return type is not written.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume that the following method header is for a method in class A. public void displayValue (int value) Assume that the following code ...” 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