逻辑运算 Posted on 2020-03-26 | In Java代码片段 逻辑运算123456789private static void test7() { // 逻辑运算 int a = 2; int b = 3; System.out.println(a + "," + b + "与运算结果:" + (a & b)); System.out.println(a + "," + b + "或运算结果:" + (a | b)); System.out.println(a + "," + b + "异或运算结果:" + (a ^ b)); System.out.println(a + "的非运算结果:" + (~a));} 结果: 12342,3与运算结果:22,3或运算结果:32,3异或运算结果:12的非运算结果:-3 Donate WeChat Pay