ICSE Class 10 Computer Applications Question 2 of 43

User-Defined Methods — Question 2

Back to all questions
2
Question

Question 2

What are actual and formal parameters of a function ?

Answer

The parameters that appear in the method call statement are called actual parameters.

The parameters that appear in the method definition are called formal parameters.

For example,

class ParameterDemo  
{
    double square(double x)    {
        return Math.pow(x,2);
    }
    
    public static void main(String args[])
    {
        ParameterDemo obj = new ParameterDemo();
        double n = 5.3;
        double sq = obj.square(n);
    }
}

Here, x is the formal parameter and n is the actual parameter.