Let’s see program for swapping of two number without using third variable in java.
package javatute;
public class SwipeOfTwoNumber {
public static void main(String[] args) {
int n1 = 10, n2 = 20;
n1 = n1 * n2;
n2 = n1 / n2;
n1 = n1 / n2;
System.out.println("after swaping value of n1 is:- " + n1);
System.out.println("after swaping value of n2 is:- " + n2);
}
}