Return Array index and increment at the same time

index++ returns index and then increments by 1. So it will do result = someArray[0] and then set index to 1.

In contrast, ++index would do the increment and then pass the incremented value. So if you wanted result set to someArray[1] in the above code, you would use ++index.

As someone else said, please don't use this kind of syntax. Instead, please write

index++;
result = someArray[index];

See: Java documentation, Assignment, Arithmetic, and Unary Operators:

The code result++; and ++result; will both end in result being incremented by one. The only difference is that the prefix version (++result) evaluates to the incremented value, whereas the postfix version (result++) evaluates to the original value.

So you'll get someArray[0].