The assignment operator,
=
, like all operators in Java,
produces a value. By convention, the value produced is the same as the
value assigned. Thus, the value of the expression y = 5
is 5
.
Because assignment expressions produce values, assignment expressions can appear as subexpressions nested inside larger expressions.
In the following assignment expression, for example, the assignment
expression, y = 5
, which assigns a value to y
, appears inside
a larger assignment expression, which assigns a value to x
:
x = (y = 5)