public class HeiMa {
public static void main(String[] args) {
demo1(3, 5);
demo2(3, 5);
demo3(3, 5);
}
public static void demo1(int a, int b) {
int c;
c = a;
a = b;
b = c;
System.out.println("a=" + a + ",b=" + b);
}
public static void demo2(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
System.out.println("a=" + a + ",b=" + b);
}
public static void demo3(int a, int b) {
a = a ^ b;
b = a ^ b;
a = a ^ b;
System.out.println("a=" + a + ",b=" + b);
}
}
|
|