Java Reference
In-Depth Information
Note that the binary numeric promotion mentioned above may include unboxing con-
is applied to the sum prior to its being stored in the variable.
A variable that is declared
final
cannot be incremented because when an access of such 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 postfix increment operator.
15.14.3. Postfix Decrement Operator
--
A postfix expression followed by a
--
operator is a postfix decrement expression.
PostDecrementExpression:
PostfixExpression
--
to a numeric type, or a compile-time error occurs.
The type of the postfix decrement expression is the type of the variable. The result of the
postfix decrement expression is not a variable, but a value.
At run time, if evaluation of the operand expression completes abruptly, then the postfix
decrement expression completes abruptly for the same reason and no decrementation oc-
curs. Otherwise, the value
1
is subtracted from the value of the variable and the difference
is performed on the value
1
and the value of the variable. If necessary, the difference is nar-
expression is the value of the variable
before
the new value is stored.
Note that the binary numeric promotion mentioned above may include unboxing con-
is applied to the difference prior to its being stored in the variable.
A variable that is declared
final
cannot be decremented because when an access of such 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 postfix decrement operator.
15.15. Unary Operators
The operators
+
,
-
,
++
,
--
,
~
,
!
, and the cast operator (§
15.16
) are called the
unary operators
.
UnaryExpression: