We can write the same statement in two different ways as follows. I have a question with providing two outputs for the value of x as follows.
int x = 10;
x = x*2+5; // Here the value of x is 25.
x = 10;
x *= 2+5; // Here the value of x is 70.
It is clear that this is because,
1. In the first statemnt x is multiplied by 2 then add 5.
2. In the second statemnt add 5 to 2 together then multiplied by x.
But why is it acting like this?
See: Operator precedence in Java.
*binds tighter than+which both are tighter than=or*=.