9.3 Additional Java Operators | 457
Operator Associativity Remarks
++ -- Right to left ++and --as postfix operators
++ -- Right to left ++and --as prefix operators
Unary +Unary – Right to left
! Right to left
(cast) Right to left
- / % Left to right
– Left to right
Left to right String concatenation
< <= > >= Left to right
instanceof Left to right
== != Left to right
& Left to right Boolean operands
^ Left to right Boolean operands
| Left to right Boolean operands
&& Left to right
|| Left to right
?: Right to left
= += –= *= /= %= Right to left
Table 9.2 Precedence (Highest to Lowest)
means
(a – b) + c
and not
a – (b + c)
Certain operators, however, are grouped from right to left—specifically, the unary operators,
the assignment operators, and the ?:operator. Look at the unary “– ”operator, for example.
The expression