Class 9 Computer Chapter - 6 & 3 (Functions)
Class 9 Computer Chapter - 6 & 3 (Functions)
Q7. What is the difference between formal and actual parameter? Give
example.
Answer: Formal Parameter : Formal Parameters are the parameters that
appear in function definition.
Actual Parameter: Actual Parameter are the parameters that appear at
function call statement.
Example :
public int product(int x, int y)
{//Defining pure function
return (x*y);
}
Here , int x , int y are the formal parameter of the function.
int p=product(12,2);
Here 12, 2 are the actual parameter of the function
Example : Example
public int product(intx, inty) public void display(int x, int y)
{ {
return (x*y); System.out.println("Product:"+(x*y));
} }