你能推算出下列幾個位元運算的結果為何嗎?- public class Ch01 {
- public static void main(String[] args) {
- System.out.println(3 | 4);
- System.out.println(5 & 6);
- System.out.println(6 ^ 7);
- System.out.println(2 | 8);
- System.out.println(7 & 10);
- System.out.println(9 ^ 10);
- }
- }
- /*
- 00000000 0
- 00000001 1
- 00000010 2
- 00000011 3
- 00000100 4
- 00000101 5
- 00000110 6
- 00000111 7
- 00001000 8
- 00001001 9
- 00001010 10
- */
複製代碼 |