|
|
Bitwise Operators |
|
6 operators, can only be applied to integer types (char, short, int, and long).
| Operator | Name | Example |
|---|---|---|
| & | bitwise AND | 1111 & 1000 = 1000 |
| | | bitwise inclusive OR | 1111 | 1000 = 1111 |
| ^ | bitwise exclusive OR | 1111 ^ 1000 = 0111 |
| << | left shift | 1111 << 2 = 1100 |
| >> | right shift | 1111 >> 2 = 0011 |
| ~ | one's complement | ~1010 = 0101 |