This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
16.1.8 Operators ++ and -- V is definitely assigned after ++a, --a, a++, or a-- iff either a is V or V is definitely assigned after the operand expression. V is definitely unassigned after ++a, --a, a++, or a-- iff a is not V and V is definitely unassigned after the operand expression. V is [un]assigned before a iff V is [un]assigned before ++a, --a, a++, or a--.
However this does not compile:
posted 14 years ago
I think JLS 15.5.1 takes precedence:
A variable that is declared final cannot be incremented, because when an access of a final variable is used as an expression, the result is a value, not a variable. Thus, it cannot be used as the operand of a prefix increment operator.
The code compile if final is left out. However preincrementing a final variable gives an error either in a method, constructor or static block.