3.7.2 通过代码完成两个整数内容的交换。
(利用中间值i进行交换吧)
public class P372 {
public static void main(String[] args) {
int x=88,y=75,i=0; //i为中间值
System.out.println("初始值x= "+x+" y= "+y);
i=x; x=y; y=i; //完成交换!
System.out.println("整数x,y内容交换后:/n"+"x= "+x+" y= "+y);
}
}