We've got a sequence of 3 postfix operators of the equal priority here:
postfix operators
[] (params) expr++ The evaluation flows left to right. First, a call to getArray() gets resolved returning null. Second, index is assigned 2 for the array, and third - the postfix increment is supposed to occur, but it never does because of NullPointerException being thrown.
Here's a modified code to demonstrate that evaluation indeed occurs left to right:
The result is:
java.lang.ArithmeticException
index = 1
You can see that index was not assigned 2 since getArray() blew up with an exception. Refer to
Operators Precedence and to the Dan's exams to clear the concept.