I spent some time to find the answer and here what i got
int temp = 0;
temp+=temp++;
ie temp = temp + temp++;
now what happens here step by stem
1 step temp = exp(0 + 0)
2 step temp value will be incremented to 1
3 step temp will be assigned the value 0 from expression 1
so actually in the expression temp value is incremented but again reset to 0 due to assignment operator
here is my code as a proof
int i=0,j=0;
System.out.println(i+=i++);
System.out.println(j+=j++);
System.out.println("i= "+i+", j="+j);
System.out.println(i=i+i++);
System.out.println(j=i+j++);
System.out.println("i= "+i+", j="+j);
j+=i++;
System.out.println("i= "+i+", j="+j);
output is
0
0
i= 0, j=0
0
0
i= 0, j=0
i= 1, j=0
so you can see in the last line value of i is 1 that is it got incremented and the value of j is 0 due to assignment operator
and yes you should use pre increment to make it work as you expected this is just to show why this unexpected behavior.