According to the JLS, subexpressions are evaluated from left to right. That’s why the first term is evaluated to 5, the second one is evaluated to 6 and third one is evaluated after the second one so it gives 6. That’s why the sum is 17.
8
solved How to evaluate this expression [duplicate]