int m = 0;
m += m++;
System.out.println(m);
prints to 0
but i thought m
will be post incremented and finally be 1
.
Would someone please explain.
Note: i know how post increment works (atleast i think i do :P). But what i am trying to figure out is that when i say m + = m++
lets assume it means m = m + m++
which will evaluate m++
after sending the value of m
, 0
in this case, and evaluate to m = 0 + 0
then increment the value of m
because of the post increment. now if post increment has occured, why is m
not 1