George Melo wrote:. . .
. . .
Actually, the Java® way to do it is go from left to right. You first evaluate
Since the assignment operator has a low precedence, everything to its right is calculated
before the assignment.
Next:-
which reduces to
The
* operator to the right has a higher precedence, so
is calculated, as,
which becomes
Filling in the ... gives us
The expression now becomes 14 and
that is assigned to
x.
If you add
(), that only changes the order of evaluation when the first
( is reached
Next:-
So far, the same as before. When the () appear, however, the expression to the right of is evaluated as a whole expression.
The second
() cause their contents to be evaluated, so 3 + 5 becomes 8:-
which becomes
then,
then
and
No, I can't see anywhere that
10 + 3 appears. Please supply more information about the
10 + 3.
When I wrote ... I meant that part of the expression is only evaluated later, not that it has vanished.