题目中有要求 不使用第三个参数实现两个参数值的互换,异或可以轻松实现, 解题思路如下: import java.util.Scanner;

public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt();

    //write your code here.......
    a = a ^ b;
    b = b ^ a;
    a = a ^ b;
    System.out.println(a+" "+b);
}

}