Java Reference
In-Depth Information
inta=0;
intb=4;
a=b=7;
If the expression
a
=
b
= 7 is evaluated left-to-right, then the resulting
value of variable
a
is 4, and the value of
b
is 7. However, if it is evaluated
right-to-left then the value of both variables is 7. Since the assignment op-
erator has right-to-left associativity, the value of
b
is 7 and the value of
a
is also 7, in this case.