日期:2014-05-20 浏览次数:20674 次
/** * 交换变量 */ static void changeField() { int i = 5; int j = 10; i = i + j; j = i - j; i = i - j; System.out.println("i:" + i + "\tj:" + j); } static void changeField1() { int i = 5; int j = 10; int temp = i; i = j; j = temp; System.out.println("i:" + i + "\tj:" + j); } static void swapField(){ int i = 1; int j = 2; i = i^j; j = i^j; i = i^j; System.out.println("i:" + i + "\tj:" + j); }?