Home Segments Top Top Previous Next

Appendix A:

Operator Precedence

The following table lists Java's precedence and associativity characteristics. Each box contains operators that have equal precedence. The top box contains the highest-precedence operators:


Operator level Associativity
( ) [ ] . left to right
! ++ -- + (unary) - (negation) new (data type) right to left
* / % left to right
+ - left to right
< <= > >= left to right
== != left to right
& left to right
ˆ left to right
| left to right
&& left to right
|| left to right
?: right to left
= += -= *= /= %= &= ˆ= |= <<= >>= right to left


Note that the name of each data type, when surrounded by parentheses, is considered a casting operator. Also, the parentheses following a method name are considered to be the function-call operator.

The & and | operators, as well as the exclusive-or operator, ^, are bitwise operators, rather than Boolean operators.