class Test
{
int a,b;
Test(int x,int y)
{
a=x;
b=y;
}
void meth(int x,int y)
{
a=x*2;
b=y/2;
System.out.println("in meth function A :"+a);
System.out.println("in meth function B :"+b);
}
}
class CallByValue
{
public static void main(String arg[])
{
int a,b;
a=10;
b=20;
Test t1= new Test(a,b);
System.out.println("A:"+a);
System.out.println("B:"+b);
t1.meth(a,b);
System.out.println("A:"+a);
System.out.println("B:"+b);
}
}
{
int a,b;
Test(int x,int y)
{
a=x;
b=y;
}
void meth(int x,int y)
{
a=x*2;
b=y/2;
System.out.println("in meth function A :"+a);
System.out.println("in meth function B :"+b);
}
}
class CallByValue
{
public static void main(String arg[])
{
int a,b;
a=10;
b=20;
Test t1= new Test(a,b);
System.out.println("A:"+a);
System.out.println("B:"+b);
t1.meth(a,b);
System.out.println("A:"+a);
System.out.println("B:"+b);
}
}
No comments:
Post a Comment