
66 CHAPTER 2 Programming Building Blocks—Java Basics
TABLE 2.11 Operator Precedence
Operator Order of Same-Statement
Hierarchy Evaluation Operation
() left to right parentheses for explicit grouping
*,/,% left to right multiplication,division,modulus
+,– left to right addition,subtraction
= right to left assignment
the right side of the assignment operator. For example, we could use these
statements to assign 32 to the variable age, then later add 1 to that value.
int age = 32;
...
age = age + 1; // now, age is 33
2.4.3 Operator Precedence
The statements in Example 2.7 perform simple calculations, but what if
you want to calculate how much money you have ...