二变量的值互换(无中间变量)

加灰| 阅读:1318 发表时间:2018-07-20 14:23:01 java

二进制的位运算

int a= 1,b=2;

a=a ^b;//异或

b=a ^b;

a=a ^b;

System.out.print("a="+a,"b="+b);