I just wanted to create a little Java-Puzzle, but I puzzled myself. One part of the puzzle is:
What does the following piece of code do:
i += ++i + i++ + ++i; is the same as i = i + ++i + i++ + ++i;
i += ++i + i++ + ++i;
i = i + ++i + i++ + ++i;
The right-hand side is calculated from left-to-right, yielding i = 1 + 2 + 2 + 4; (which yields i = 9).
i = 1 + 2 + 2 + 4;
i = 9