有多种
int temp; int a=3,b=4;
1.temp=a;
a=b;
b=temp;
2,a=a+b;
b=a-b;
a=a-b;
3,a^=b;
b^=a;
a^=b;
class text{
public static void main( String [] args){
int a=5;
int b=3;
a^=b;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
b^=a;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
a^=b;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
}
}
int temp; int a=3,b=4;
1.temp=a;
a=b;
b=temp;
2,a=a+b;
b=a-b;
a=a-b;
3,a^=b;
b^=a;
a^=b;
class text{
public static void main( String [] args){
int a=5;
int b=3;
a^=b;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
b^=a;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
a^=b;
System.out.println(a);
System.out.println(b);
System.out.println("____________");
}
}