169k views
5 votes
Is the following statement a valid parameter declaration? please explain!! i need a lot of help! thank you!

public void baseball (int batting average, hits,homeruns)

User Cargowire
by
6.7k points

1 Answer

4 votes

Answer:

NO

Step-by-step explanation:

The parameter is declared in the function definition which takes the value from the calling function.

In the define function, we also declare the parameters with it type like int, char, float or double, etc.

Let's discuss the given function:

public void baseball (int batting average, hits,homeruns)

In the function, three variables are shown.

1. int batting average: Here, the variable type (int) is declared but the variable is not valid because the programming variable must NOT contain any space.

here, space exists between batting and average which is wrong.

2. hits: here, the variable type is not declared. this parameter is also not correct to declare.

3. homeruns: the variable type is not declared. this parameter is also not correct to declare.

Therefore, the statement has no valid parameter declaration.

User Uncle Iroh
by
6.1k points