The following code in Java:
int a = 0, b = 0, c = 0;
boolean d = (a++ > 0 && b-- < 0) || --c < 0;
results in the values:
a = 1, b = 0, c = -1 and d = true
I don't understand why a
is = 1, because it is a post-increment and should also react the same way that value b does. Also, if I change the b--
to --b
it still has no effect on the value of b.
What is the best way of understanding this logic?