The statement i = i++
has well-defined behavior in Java. First, the value of i
is pushed on a stack. Then, the variable i
is incremented. Finally, the value on top the stack is popped off and assigned into i
. The net result is that nothing happens -- a smart optimizer could remove the whole statement.