1// swap two variables in java in single line
2public class SwapTwoVariablesInOneLine
3{
4 public static void main(String[] args)
5 {
6 int x = 23;
7 int y = 75;
8 System.out.println("Before swapping two numbers: x = " + x + " y = " + y);
9 x = x ^ y ^ (y = x);
10 System.out.println("After swapping two numbers: x = " + x + " y = " + y);
11 }
12}