两个常量交换值,不用到第三个变量
int x = 3;int y = 8;/*方法一x = x + y;y = x - y;x = x - y;*//*方法二x ^= y;y ^= x;x ^= y;*/System.out.println("x="+x+";y="+y);