Difference between an argument and a parameter?
Answer Posted / 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 |
Post New Answer View All Answers
Why are global variables used?
Can we execute a program without main() method?
Are arrays immutable in java?
What is entry in java?
What is vector?
Why do we use predicate in java?
Why synchronization is important?
Why string is not thread safe?
What are java annotations?
How do you remove an element from an arraylist in java?
What are three ways in which a thread can enter the waiting state in java programming?
What is the difference between static and global variables and also define what are volatile variables?
What is the use of parseint in java?
Why is a singleton bad?
What is the default size of arraylist in java?