int a = 14;
int b = 2;
int x = a & b;
int y = a | b;
int z = a ^ b;
System.out.println(a + "&" + b + "=" + x);
System.out.println(a + "|" + b + "=" + y);
System.out.println(a + "^" + b + "=" + z);
结果:
14&2=2
14|2=14
14^2=12
int b = 2;
int x = a & b;
int y = a | b;
int z = a ^ b;
System.out.println(a + "&" + b + "=" + x);
System.out.println(a + "|" + b + "=" + y);
System.out.println(a + "^" + b + "=" + z);
结果:
14&2=2
14|2=14
14^2=12