Answer to Question #111766 in Java | JSP | JSF for Stephen

Question #111766
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-04-24T11:34:06-0400

formal parameter - an argument specified when declaring or defining a function.

actual parameter is the argument passed to the function when it is called.


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