Professional Documents
Culture Documents
Expression
Expression
2 Expression
Expressions perform operations on data and move data around. Some expressions will
be evaluated for their results, some for their side effects, some for both.
An assignment expression is most often used for its side effect: it changes the
value of the variable selected by the variable expression to the value of the
expression on the right-hand side. The value of the assignment expression is the
value that is assigned to the selected variable.
The Java arithmetic and bitwise operators can be combined with = to form assignment
operators.
For example, the += assignment operator indicates that the right-hand side should
be added to the variable, and the *= assignment operator indicates that the right-
hand side should be multiplied into the variable.