I just strugle to understand something about java operator precedence and assignments. Here the example:
int a = 10, b = 20;
int c = a + (a = b) * 0;
Why is the result c = 10
? This means that for the first a
in the calculation the old value of a
is used. But the assigment in ( )
should have a higher precedence than the addition. Why isn't it done first?