Login    New User    Forgot Password    Help      

Methods Bypass

Java Tutorials

The values that are passed to a method are called actual arguments in the Java specification. However, it is very common for them to be called just argumentsactual parameters, or just plain parameters. These terms are so used interchangeably so often that even the Java specification isn't entirely consistent. For a value which is passed in a call I'll try to stick to actual argument or just argument, which are generally regarded as the "best" terms.

Example

class abc
{
int a;
int b;
        void getdata(int x,int y)
        {
        a=x;
        b=y;
        }
        void showdata()
        {
        System.out.println("Value of a is " +a);
        System.out.println("Value of b is " +b);
       
        }
       
}

class clas3
{
public static void main(String args[])
{
// Create ob1 object of class abc

abc ob1=new abc();
ob1.getdata(10,20);

ob1.showdata();

}

}

Output

e:\java\java clas3

Value of a is 10

Value of b is 20

Java Tutorials