Home > DeveloperSection > Interviews > What is the difference between Parameter and Argument in Java?

Posted on    November-05-2015 10:12 PM

 Java Java 
Ratings:
 1 Answer(s)
  422  View(s)
Rate this:

Devesh Kumar Singh

Total Post:12

Points:60
Posted on    November-05-2015 11:12 PM

       The term parameter refers to any declaration within the parentheses following the method/function name in a method/function declaration or definition.

        Whereas, the term argument refers to any expression within the parentheses of a method/function call. i.e.

·         Parameter used in function/method definition.

 

public static int add(int x, int y) { //x, y are parameters here

 

·         Arguments used in function/method call.

 int sum = add(x, y);  //x, y are arguments here


Modified On Nov-05-2015 10:19:57 PM

Don't want to miss updates? Please click the below button!

Follow MindStick