Difference between “Argument“ and “Parameter“ in programming

Two words a lot of people think are synonyms. They are not!

Andrei Albu
SCIENTIFIC ZOOM

--

Let’s be brief. Look at the following example.

Using Java.

Here we have a class called Example which contains two methods: the main method and the “example“ method. Look at the last one!

In his signature it is written «public static void example(String name){…}». That is the definition of the method “example“.

“name“ is the parameter of the method. That’s it!

A parameter is a variable which is part of the method’s signature.

So, what is the argument of a method?

Now look inside of the main method. First it is defined a String variable called “name“ equal to “Andrei“. Then the method “example“ is called with that variable as … argument.

An argument is a variable passed to the method when it is called (when the method is used, not defined!).

--

--

Andrei Albu
SCIENTIFIC ZOOM

Writer and Reader — I am 24. Writing about software, computers, programming languages, business, marketing, psychology and many other topics. Writing daily.