public class Swapping {
public static void main(String args[]){
int x = 20;
int y = 30;
//Swapping 2 numbers without using temp variable
x = x + y;
y = x - y;
x = x - y;
System.out.println("Value of x: "+x);
System.out.println("Value of y: "+y);
}
}
Output:
