public static void main(String[] args)
{
int x = 10;
int y = 5;
//
// int temp = x;
// x =y;
// y = temp;
// System.out.println(x+"---"+y);
//有可能超出取值范围
// x = x+y;
// y = x-y;
// x = x-y;
// System.out.println("x=:"+x+"y=:"+y);
x = x^y;//10^5
y = x^y;
x = x^y;
System.out.println("x=:"+x+"y=:"+y);
}
|
|