# Operators Doubt

Hardik Raja
Ranch Hand
Posts: 117
The below is a Two Minute Drill from chapter 4, Operator (K & B Book)
Page 300

> Increment/Decrement Operators

In any expression, both operands are fully evaluated before the operator
is applied.

Can anyone explain the above statement with an example.
Any suggestions are welcome.

Regards,
Hardik.S.Raja

dhwani mathur
Ranch Hand
Posts: 621
ok ,explanation for this is here,shown below may be it helps you to some extent.

Evaluation Order

In Java, the order of evaluation of operands in an expression is fixed. All operands are evaluated from left to right. The order of execution of the operations may be completely different. For example:

int [] a = {5, 5};
int b = 1;
a[b] = b = 10;
In this example, on line 3 the a[b] operand is evaluated to a[1] because at that moment b equaled 1. Next b is evaluated to 1 again. Finally, 10 is evaluated simply as the constant 10. After the operands are evaluated, the assignment operations take place. Assignment is a right to left operation, so b is assigned 10 and then a[1] is assigned the value of b, which is 10.