What Is The Difference Between Parameters and Argument in Java?

March 16, 2013

image credit:www.python-course.eu
A method uses parameter but a calling method passes argument. So arguments are those which are passed to methods.Parameters are those values which try to catch the arguments sent by the caller/calling methods and assign it to a local variable.

A parameter is a part of method signature whereas the arguments are expressions used to call a method.

The argument sent by the calling method goes and sit exactly the same order in the parameter list.

Arguments can be of variable type
int val=add(3,5);
int val=add(a,b);
//here we are passing arguments to the method add.

public int add(int a,int b)
// int a,int b are parameters for this method
return a+b;
By this way the values can be passed to called method.This is called pass by value.

You Might Also Like