15.14.2
Prefix Decrement Operator
EXPRESSIONS
and the sum is stored back into the variable. Before the addition, binary numeric
promotion ( 5.6.2) is performed on the value
1
and the value of the variable. If
necessary, the sum is narrowed by a narrowing primitive conversion ( 5.1.3) to
the type of the variable before it is stored. The value of the prefix increment
expression is the value of the variable
after
the new value is stored.
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.
15.14.2 Prefix Decrement Operator
He must increase, but I must decrease.
John 3:30
A unary expression preceded by a
operator is a prefix decrement expression.
The result of the unary expression must be a variable of a numeric type, or a com
pile time error occurs. The type of the prefix decrement expression is the type of
the variable. The result of the prefix decrement expression is not a variable, but a
value.
At run time, if evaluation of the operand expression completes abruptly, then
the prefix decrement expression completes abruptly for the same reason and no
decrementation occurs. Otherwise, the value
1
is subtracted from the value of the
variable and the difference is stored back into the variable. Before the subtraction,
binary numeric promotion ( 5.6.2) is performed on the value
1
and the value of
the variable. If necessary, the difference is narrowed by a narrowing primitive con
version ( 5.1.3) to the type of the variable before it is stored. The value of the pre
fix decrement expression is the value of the variable
after
the new value is stored.
A variable that is declared
final
cannot be decremented, 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 decrement operator.
15.14.3 Unary Plus Operator
+
The type of the operand expression of the unary
+
operator must be a primitive
numeric type, or a compile time error occurs. Unary numeric promotion ( 5.6.1)
is performed on the operand. The type of the unary plus expression is the pro
moted type of the operand. The result of the unary plus expression is not a vari
able, but a value, even if the result of the operand expression is a variable.
At run time, the value of the unary plus expression is the promoted value of
the operand.
348
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved