I\'m trying to get deeper with post and pre incrementors but am a bit stuck with the following expression :
public static void main(String[] args) {
int i
I traced the value of i and here are the results:
i = i+=(++i + (i+=2 + --i) - ++i);
initialization: i = 0;
++i: i = 1;(1st one) and store this value
(i+=2 + --i): In it
--i: i = 0;(i was changed by the previous ++i)
i += 2 + 0: i = 2;(value of the inner (i+=2 + --i), store it)
++i: i = 3;
1 + 2 -3: i = 0;
i += 0: i = 0;
The value of the 2nd i from the left is not zero, it is the value of i after all the operations to the right are finished.