WHAT IS THE DIFFERENCE BETWEEN PARAMETER AND ARGUMENT IN JAVA?

Devesh Kumar Singh

Total Post:12

Points:60
Posted by  Devesh Kumar Singh
Java 
 703  View(s)
Ratings:
Rate this:
  1. Devesh Kumar Singh

    Post:12

    Points:60
    What is the difference between Parameter and Argument in Java?

           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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!