This is a simple method for swapping the values of two numeric variables without using a third variable.
The sample java code is given below.
public void Swapping(int a, int b)
{
System.out.println(Values Before Swapping);
System.out.println(a+" , "+b);
a=a+b;
b=a-b;
a=a-b;
System.out.println(Values After Swapping);
System.out.println(a+" , "+b);
}