What's the difference between "Parameters" and "Arguments" in methods of JAVA ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

What's the difference between "Parameters" and "Arguments" in methods of JAVA ?

Differentiate them by using an example. Is arguments and parameter values are same ? If both are same why they named different .

17th May 2019, 11:29 AM
Hari Gopal
Hari Gopal - avatar
3 Answers
+ 26
A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters. public void MyMethod(string myParam) { } ... string myArg1 = "this is my argument"; myClass.MyMethod(myArg1);
15th Jun 2019, 10:25 AM
Keerthana
Keerthana - avatar
+ 11
harigopal199 Parameters are the variables declared in method headers. Arguments are what you actually pass into said method public static int example(int parameters) { return 0; } public static void main (String[] args) { int argument = 0; Class.example(argument); }
17th May 2019, 11:41 AM
Earl Chukwu
Earl Chukwu - avatar
+ 2
A parameter is a variable in the declaration of the function...and Argument is the actual value of the variable that get passed to the function when invoked....
22nd Jun 2019, 9:30 AM
Dedseć
Dedseć - avatar