Answer to Question #134761 in Python for Elizabeth

Question #134761
Discuss the concept of parameters. What are parameters for? What is the difference between formal parameters and actual parameters? Give an example in Java code that illustrates formal parameters and actual parameters.
1
Expert's answer
2020-09-24T06:38:35-0400

Parameters are used to pass data to the method.

This allows to call same method with different values of data.

Actual parameters - variables or values passed to the method while calling.

Formal parameters - variables declared in method signature (between parentheses).


public double myFunction(int a,double b)// int a, double b - formal parameters of the myFunction method
{
//do something
}


public static void main(String[] args) {

myFunction(5, 3.14); // 5, 3.14 - actual parameters of the myFunction method

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS