Parameters vs Arguments
Hi there! How are you? I hope you are well!
Well, here is a short note trying to clarify once and for all the notion of Parameter against the notion of an Argument!
Differences
Parameters are special kind of variables which are plain references to the actual values they point at. This is similar to the separation of variable declaration and variable initialization. Analogically, the parameter is a simple variable without initialization while an argument is the same variable but this time initialized and assigned with an actual value.
For example:
public void greeting(String name) { System.out.println("Hello " + name); }
In this case we have a function definition and this function expects to have one Parameter, marked with bold.
When we actually invoke this function somewhere in our code, then we “initialize” the Parameter name of type String on the fly and this value is called Argument from now on! For example,
greeting("George");
The Argument is the string George!
Cheers!