...
This code can fail as a result of the same errors it is trying to prevent. When array
is NULL
or i
is not a valid index, the reference to array
and array[i]
will cause either a NullPointerException
or an ArrayIndexOutOfBoundsException
to be thrown. This happens The exception occurs because the &
operator fails to prevent evaluation of its right operand even when evaluation of its left operand proves that the right operand is inconsequential.
...