Difference between an argument and a parameter?




Answers were Sorted based on User's Feedback



Difference between an argument and a parameter?..

Answer / dev

The words argument and parameter are often used
interchangeably although the C++ Standard makes a clear
distinction between the two.

An argument is an expression in the comma-separated list in
a function call or the operand of a throw-statement

A parameter is an object or reference that is declared in a
function declaration or definition (or in the catch clause
of an exception handler);


This example demonstrates the difference between a
parameter and an argument:

void func(int n, Object obj); //n and obj are parameters

static void main(String s[])
{
Object p = new String("hi");
func(5, p); //5 and p are arguments
}

Is This Answer Correct ?    155 Yes 23 No

Difference between an argument and a parameter?..

Answer / janet

while defining method,variables passed in the method are
called parameters.while using those methods,values passed
to those variables are called arguments.

Is This Answer Correct ?    133 Yes 9 No

Difference between an argument and a parameter?..

Answer / dhawal

parameters are those that are passing to the method at the
time of defining the method but arguments are those which
are passed at the time of calling that method

Is This Answer Correct ?    34 Yes 4 No




Difference between an argument and a parameter?..

Answer / venkatesh

what ever we are passing in the method is called parameters
& whatever we are passing in method calling is called is
arguments

Is This Answer Correct ?    39 Yes 12 No

Difference between an argument and a parameter?..

Answer / roqaya nezar

suppose i have a method that i just defined, the variablse
i passed to this method are the parameters
but, when i use the defined method i will pass values to
its variables, now they are arguments.

Is This Answer Correct ?    29 Yes 8 No

Difference between an argument and a parameter?..

Answer / aditya

variables defined in the method eg: sum(int a ,int b)
here a and b are parameters which r variables.

the values passed to that variables r called arguments.

Is This Answer Correct ?    22 Yes 6 No

Difference between an argument and a parameter?..

Answer / pankaj kaundal

In the method and function declaring valiable with data type
is known as parameater it is a refrence type.
void sum(int x, int y)//is parameter
and when it call and passing value is known as argument
like
object o=new object();
o.sum(12,20);//it is argument

Is This Answer Correct ?    19 Yes 5 No

Difference between an argument and a parameter?..

Answer / venkat

while we are declaring method this parameters
ex: public void test(int a,int b)
{}= this is parameters
while we are passing values through object refernce this
arguments
ex: A a=new A();
a.test(5,5);=this is arguments

Is This Answer Correct ?    16 Yes 3 No

Difference between an argument and a parameter?..

Answer / sagar

Whenever we are define a method with objects or references or variables then that objects or references or variables are called as parameters.

Whenever we are calling using that method with their objects or references or variable values through that class object is called arguments

Example :

class abc
{
public void display(int a,int b,)//where a and b are parameters.
{
System.out.println("The values of passed arguments are: a="+a+"b="+b);
}
public static void main(String args[])
{
abc a=new abc();
a.display(400,500);//where 400,500 are arguments.
}
}

Is This Answer Correct ?    11 Yes 2 No

Difference between an argument and a parameter?..

Answer / rasool.sk

Whenever we are define a method with objects or references then that objects or references are called as parameters.

Whenever we are calling using that method with their objects or references values through that class object is called arguments

Is This Answer Correct ?    7 Yes 5 No

Post New Answer



More Core Java Interview Questions

EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.

1 Answers   EDS,


Can Anybody tell the diff b/w jdk1.6 and latest version.

2 Answers  


Differentiate between stringbuffer and stringbuilder in java.

0 Answers  


How you can create a radio buttion using Checkbox class?

1 Answers  


Can you call one constructor from another if a class has multiple constructors?

0 Answers  






What is the difference between set and list?

5 Answers  


Which of the following can be referenced by a variable? A. The instance variables of a class only B. The methods of a class only C. The instance variables and methods of a class

2 Answers  


What are scriptlets?

0 Answers  


What do you mean by flow of struts?

0 Answers   Amdocs,


Define how destructors are defined in java?

0 Answers  


What classes can be used to store arbitrary number of objects ?

1 Answers  


WHAT IS MARKER INTERFACE,AND NO METHODS IS NOT THERE ON THAT INTERFACE THEN WHY WE USED IN JAVA?

3 Answers   L&T,






Categories