Difference between an argument and a parameter.

Modified on Tue, 28 Mar, 2023 at 3:49 PM

parameter is a variable that is declared in a method and receives a value when the method is called.

An argument, on the other hand, is the actual value that is passed to a method when it is called.

Check the snippet given below to know the difference:

In this example, the add() method takes two integer parameters, num1 and num2. When the add() method is called with the arguments a and b, the values of a and b are passed to the num1 and num2 parameters respectively.

Inside the add() method, the values of num1 and num2 are added together and the result is returned.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article