Operator Example Result
~ ~3 -4
& 3 & 4 0
| 3 | 4 7
^ 5 ^ 4 4
Operand 1 Operator Operand 2 Result
0 & 0 0
0 & 1 0
1 & 0 0
1 & 1 1
0 | 0 0
0 | 1 1
1 | 0 1
1 | 1 1
0 ^ 0 0
0 ^ 1 1
1 ^ 0 1
1 ^ 1 0
public class MainClass {
public static void main(String[] argv) {
System.out.println(~3);
System.out.println(3 & 4);
System.out.println(3 | 4);
System.out.println(5 ^ 4);
}
}
|