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
}
Comments
Leave a comment