Parameters are used to provide some external data for a method. A formal parameter is a variable in a function definition, while an actual parameter is an actual input at function call.
The next Java code illustrates formal and actual parameters:
class Main
{
// The parameter in the function definition is a formal one
public static void method(int formalParameter) { }
public static void main(String[] args)
{
// The next variable that is passed to the method is an actual parameter
int actualParameter = 5;
method(actualParameter);
}
}
See more here:
https://en.wikipedia.org/wiki/Parameter_(computer_programming)#Parameters_and_arguments
Comments
Leave a comment