Java Reference
In-Depth Information
15.6. Normal and Abrupt Completion of Evaluation
Every expression has a normal mode of evaluation in which certain computational steps are
carried out. The following sections describe the normal mode of evaluation for each kind
of expression.
If all the steps are carried out without an exception being thrown, the expression is said to
complete normally
.
If, however, evaluation of an expression throws an exception, then the expression is said to
complete abruptly
. An abrupt completion always has an associated reason, which is always
a
throw
with a given value.
Run-time exceptions are thrown by the predefined operators as follows:
value of any dimension expression is less than zero.
object reference expression is
null
.
• A method invocation expression (§
15.12
) that invokes an instance method throws
a
NullPointerException
if the target reference is
null
.
array reference expression is
null
.
value of the array index expression is negative or greater than or equal to the
length
of the array.
missible at run time.
ArithmeticException
if the value of the right-hand operand expression is zero.
result of boxing conversion (§
5.1.7
).