Okay, so I have this piece of code tested and I found there isn\'t any exception thrown out.
public static void main(String[] args) {
int[] list = {1,2}
Yes, both usages are semantically equivalent... That is, unless the length is > 2, then is the code allowed to access more than the 2nd element.
In the first case, what matters is the && operator, think of it as:
If first condition is true then apply second condition.
The subsequent condition also has an implicit "then" clause
if length greater than two
then access third element