+ 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 .
3 Réponses
+ 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);
+ 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);
}
+ 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....