-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariableExchange.java
More file actions
30 lines (26 loc) · 638 Bytes
/
VariableExchange.java
File metadata and controls
30 lines (26 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package java01;
import java.util.Scanner;
public class VariableExchange {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner scan = new Scanner(System.in);
System.out.println("输入A");
int A = scan.nextInt();
System.out.println("输入B");
int B = scan.nextInt();
System.out.println("A等于"+A);
System.out.println("B等于"+B);
A = A ^ B;
System.out.println("A等于"+A);
System.out.println("B等于"+B);
B = B ^ A;
System.out.println("A等于"+A);
System.out.println("B等于"+B);
A = A ^ B;
System.out.println("A等于"+A);
System.out.println("B等于"+B);
}
}