Another way by which we can call swap program into main method f

01/01/2002 07:42

 

This method of calling is also called as "call by values"

public class values
{
void swap(int a,int b)
{
int c;
c=a;
a=b;
b=c;
System.out.println(a);
System.out.println(b);
}
public static void main(String args[])
{
int x=10;
int y=15;
values ob1=new values();
ob1.swap(x,y);
}
}