public static void main(String[] args) { int m=12; int n=5; m^=n;//异或运算交换数字的位置 n^=m; m^=n; System.out.println("m:" + m +'\n' + "n:" +n); } 运行结果: n=12; m=9;