import java.util.Scanner;
public static class{ public static void main(String[] args){ //键盘录入两个int类型的数据,交换这两个变量的值,并输出交换后的值 a = sc.nextInt(); b = sc.nextInt(); System.out.println(a); System.out.println(b); //方法一:借助第三个变量 int temp = a; a = b; b = temp; System.out.println(a); System.out.println(b); //方法二:按位异或 a = a^b; b = a^b; a = a^b; System.out.println(a); System.out.println(b); //方法三:运算,赋值 a=(a+b)-(a=b); System.out.println(a); System.out.println(b); //方法四:模拟第三个变量(差) //假设a是a,b中较大的值 a = a-b; //a2 = a1-b1(差) -1 b = b+a; //a3 = a1-b1-b1; 1 a = b-a; System.out.println(a); System.out.println(b); }}