The results in C++ are variable depending on the OS. The results in Java are always the same independent of the OS.
I think I would never do this in real life. You assign the value of 'i' (in this case '0') to i before the increment happens. On the other hand, if you use i = ++i, you will always increment 'i' before you assign it to 'i'.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
As Marilyn pointed out, "i = i++" is undefined in C++. This is potentially a problem since a program that returned one result when compiled in one OS may return different results when compiled in another OS. In Java, "i = i++" is defined and will always return the same result no matter which compiler or OS you use.
The important point to remember is that in Java, the ++ operator is executed *immediately*, it's just that the result of i++ is the value of i before the increment.
i = i++;
will *first* increment i, then assign i the value of i before the increment.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus