Operators02
Welche Ausgabe erwartest Du nach Ablauf des abgebildeten Codings?
Coding
int a = 0;
int b = 0;
int c = 0;
int d = 5;
int e = 3;
int f = 4;
int g = 0;
int h = 2;
a = 3 * ++b;
c = 3 * a++;
d *= 6 + ++e;
e = --f - 5 - f--;
f = f + d % (e * 2);
g = (h-- + 2) * (1 + --h);
System.out.println("a: " + a);
System.out.println("b: " + b);
System.out.println("c: " + c);
System.out.println("d: " + d);
System.out.println("e: " + e);
System.out.println("f: " + f);
System.out.println("g: " + g);
System.out.println("h: " + h);
- -
- a
- b
- c
- d
- e
- f
- g
- h
Zeile | Wert |
---|---|
1 | a = 0 |
10 | a = 3 * 1 = 3 |
11 | a = 3 + 1 = 4 |
Zeile | Wert |
---|---|
2 | b = 0 |
10 | b = 0 + 1 = 1 |
Zeile | Wert |
---|---|
3 | c = 0 |
11 | c = 3 * 3 = 9 |
Zeile | Wert |
---|---|
4 | d = 5 |
13 | d = 5 * (6 + 4) = 50 |
Zeile | Wert |
---|---|
5 | e = 3 |
13 | e = 3 + 1 = 4 |
14 | e = 3 - 5 - 3 = -5 |
Zeile | Wert |
---|---|
6 | f = 4 |
14 | f = 4 - 1 = 3 |
14 | f = 3 - 1 = 2 |
15 | f = 2 + 50 % (-5 * 2) = 2 |
Zeile | Wert |
---|---|
7 | g = 0 |
17 | g = (2 + 2) * (1 + 0) = 4 |
Zeile | Wert |
---|---|
8 | h = 0 |
17 | h = 2 - 1 = 1 |
17 | h = 1 - 1 = 0 |