Vijay and Shyam
As I understand it, it is the original value of the variable that is stored in the temporary register so that the process is like this:
From the
JLS Section 15.14.1
The value of the postfix increment expression is the value of the variable before the new value is stored.
For the simplified case of x = x++;
What happens is that the initial value of x is stored in a temporary register, then x is incremented, then the value stored in the register is asigned to the left hand side of the expression, in this case the LHS is x so x gets its original value.
int x = 1;
x = x++;
Steps:
1 initial value of x is stored in temp register. So temp = 1.
2 x is incremented. x = 2 and temp = 1.
3 the value of the temp register is assigned to the LHS. x = 1
If you think about it this makes sense to store the original value and then use it in the expression evaluation, that way when your done evaluating the expression you just substitute in the value in the temp register for the original variable. If you store the incremented value then the compiler would have to check to see if your assignng the result of the expression to the original variable and invalidate the value in the temp register - this seems like a lot of work to make something this confusing happen. By doing it the first way, the subject of this entire discussion just happens as a by product of the way the post-increment operator works, this it gives us a cahnce to have these interesting conversations and amaze and astound our friends.
hope that clears it up
------------------
Dave
Sun Certified Programmer for the Java� 2 Platform