package com.Summer_0424.cn; /**
* @author Summer
* a,b,c为3个整型变量,在不引入第四个变量的前提下写一个算法实现 a=b b=c c=a?
*/
public class Test04 { public static void main(String[] args) {
int a=1,b=2,c=3;
a = a^b;
b = a^b;
a = a^b; //a与b完成互换
b = b^c;
c = b^c;
b = b^c; //b和c完成互换 System.out.printf("%d,%d,%d",a,b,c);
} }