Exclusive OR
An important Boolean function is the bitwise exclusive or function ⊕ :
a | b | a ⊕ b |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Sometimes called a half-adder or XOR, ⊕ is true if a or b is true, but not both. The Java operator for ⊕ is ^.
An important fact is that (a ⊕ b) ⊕ b = a.
Exclusive OR has many important uses: