Sorry, but if 1 isn't correct, I'm going to have to beat a dead horse (such a horrible thing to do at a [
java]ranch as I'm not even sure what terms could be searched to find the prior threads Thomas referenced!
According to this chart (and others):
http://www.sorcon.com/java2/precedence.htm the ++ operator has precedence over =
However, it is a post-incrementer.
Therefore, here's what I would *think* would happen.
1. i = 0;
2. i = i++;
So although I know from what Thomas said that 1 is wrong, it looks to me as though 0 is first assigned to i in line 2 (the current value), and then i is incremented 1 due to the i++. Since it is mutable, that *should* result in a value of 1 in my mind.
So assuming it doesn't, why not? (or how can I find the threads that already discuss it since I'm not having any success doing so?)
Ross