Java Reference
In-Depth Information
• Otherwise, the value of the left-hand operand is saved and then the right-hand op-
erand is evaluated. If this evaluation completes abruptly, then the assignment ex-
pression completes abruptly for the same reason and no assignment occurs.
• Otherwise, the saved value of the left-hand variable and the value of the right-hand
operand are used to perform the binary operation indicated by the compound as-
signment operator. If this operation completes abruptly, then the assignment ex-
pression completes abruptly for the same reason and no assignment occurs.
• Otherwise, the result of the binary operation is converted to the type of the left-
hand variable, subjected to value set conversion (§ 5.1.13 ) to the appropriate stand-
ard value set (not an extended-exponent value set), and the result of the conversion
is stored into the variable.
If the left-hand operand expression is an array access expression (§ 15.13 ) , then:
• First, the array reference subexpression of the left-hand operand array access ex-
pression is evaluated. If this evaluation completes abruptly, then the assignment
expression completes abruptly for the same reason; the index subexpression (of the
left-hand operand array access expression) and the right-hand operand are not
evaluated and no assignment occurs.
• Otherwise, the index subexpression of the left-hand operand array access expres-
sion is evaluated. If this evaluation completes abruptly, then the assignment ex-
pression completes abruptly for the same reason and the right-hand operand is not
evaluated and no assignment occurs.
• Otherwise, if the value of the array reference subexpression is null , then no assign-
ment occurs and a NullPointerException is thrown.
• Otherwise, the value of the array reference subexpression indeed refers to an array.
If the value of the index subexpression is less than zero, or greater than or equal to
the length of the array, then no assignment occurs and an ArrayIndexOutOfBoundsEx-
ception is thrown.
• Otherwise, the value of the index subexpression is used to select a component of
the array referred to by the value of the array reference subexpression. The value
of this component is saved and then the right-hand operand is evaluated. If this
evaluation completes abruptly, then the assignment expression completes abruptly
for the same reason and no assignment occurs.
For a simple assignment operator, the evaluation of the right-hand operand
occurs before the checks of the array reference subexpression and the index
Search WWH ::




Custom Search