Operators03
Welche Ausgabe erwartest Du nach Ablauf des abgebildeten Codings?
Coding
byte a = 116;
byte b = 59;
byte c, d, e, f;
c = (byte) (a & b);
d = (byte) (a | b);
e = (byte) (a ^ b);
f = (byte) (~a);
System.out.println("c: " + c);
System.out.println("d: " + d);
System.out.println("e: " + e);
System.out.println("f: " + f);
- -
- c
- d
- e
- f
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
---|---|---|---|---|---|---|---|---|---|
a | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
b | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | |
a & b | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 4810 |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
---|---|---|---|---|---|---|---|---|---|
a | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
b | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | |
a | b | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 12710 |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
---|---|---|---|---|---|---|---|---|---|
a | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
b | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | |
a ^ b | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 7910 |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
---|---|---|---|---|---|---|---|---|---|
a | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
~a | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | |
~ | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
+1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | -11710 |