Actual And Formal Parameters in Java


☞The values are passed to a function with the defined parameters.

☞The parameters , described in the method header used to receive the values from its caller are called Formal Parameters.

☞The values actually passed to the method at the time of its call are known as Actual Parameters.

Example

class Addition{
    
    void sum(int a, int b){  //a and b are formal parameters
        System.out.println(a+b);
    }
    
    public static void main(String args[]){
        Addition obj=new Addition();
        obj.sum(5,6);       //5 and 6 are actual parameters
    }
    
}

Output

11