Professional Documents
Culture Documents
Discussion Assignment Unit 3
Discussion Assignment Unit 3
Information can
be passed to methods as parameter. Parameters are specified after the method name, inside the parentheses. You
can add as many parameters as you want, just separate them with a comma. There are two types of parameters, the
formal parameter and the actual parameter.
Actual parameter: the actual value that is passed into the method by a caller. The parameters that are passed while
calling or invoking the method are known as actual parameters.
public static int multiplication (int num1, int num2) // here the variables num1 and num2 are formal parameter.
{
int product = num1*num2;
System.out.println("the product is "+product);
return product;
}
public static void main(String [ ] args){
multiplication(56,87); // here 56 and 87 are actual parameter.
}
}
Formal parameters are the variables or objects that are defined in the function/method signature, whereas
actual parameters are the variables that are sent when calling a function/method.