135k views
4 votes
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?

User Haroldcarr
by
4.5k points

1 Answer

6 votes

Answer:

int number = 100;

displayValue(number);

Step-by-step explanation:

In order to call the method, we need to write its name and pass the parameters, if it has any.

The method public void displayValue(int value) takes one parameter, an integer value. Firstly, we need to initialize the value and, then call the method with that value as seen below.

int number = 100;

displayValue(number);

User Vishwanath Dalvi
by
4.9k points