what is the difference between an arguments and parameters

coderlegi0n

CoderLegion

Posted on June 7, 2021

what is the difference between an arguments and parameters

In this blog, we will look at the difference between arguments and parameters. This is irrespective of the programming language.

In any programming language, If we need to do something, again and again, we create a method for it. Thus the method has 3 important parts:

Method declaration.
Method definition
Method calling.
When we define any method the variable in the parenthesis are nothing but the parameters and When the method is called, the data we pass into the method is Arguments.

Consider an Example

package com.abc;
public class Example {
    public static void main(String[] args) {

        int argument1 = 2;
        int argument2 = 3;
        methodName(argument1,argument2);
    }

    private static void methodName(int parameter1, int parameter2) {
        //Do the Logic
    }
} 
Enter fullscreen mode Exit fullscreen mode

Here, During calling the method, the data we passed is called Argument and in Method Definition the value which we get in a variable is called Parameters.

Note: Parameters are Variables and Arguments are values passed to variables.

Thank you for reading this article!!

💖 💪 🙅 🚩
coderlegi0n
CoderLegion

Posted on June 7, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related