int a = 1, b = 2, temp; temp = a; a = b; b = temp;
方法二:变量加减法(即121,加减减)
int a = 1, b = 2; a = a + b; b = a - b; a = a - b;
方法三:使用按位异或
int a = 1, b = 2; a = a ^ b; b = a ^ b; a = a ^ b;