CPSC 120B: Fundamentals of Computer Science I
Fall 2009: Java Operator Precedence
| Priority |
Operator |
Operation |
| 1 |
[] |
array access |
| . |
member acces |
| () |
method invocation |
| 2 |
++ |
increment |
| -- |
decrement |
| - |
numerical negation |
| ! |
boolean negation |
| (type) |
type cast |
| new |
object creation |
| 3 |
* |
multiplication |
| / |
division |
| % |
modulo |
| 4 |
+ |
addition, concatenation |
| - |
subtraction |
| 5 |
<< |
left bit shift |
| >> |
right bit shift |
| 6 |
< |
less than |
| <= |
less than or equal to |
| > |
greater than |
| > |
greater than or equal to |
| 7 |
== |
equal to |
| != |
not equal to |
| 8 |
& |
bitwise and |
| 9 |
| |
bitwise or |
| 10 |
^ |
bitwise exclusive or |
| 11 |
&& |
logical and |
| 12 |
|| |
logical or |
| 13 |
: ? |
conditional |
| 14 |
= |
equal to |
| *= |
times equals |
| /= |
divide equals |
| += |
plus equals |
| -= |
minus equals |
| %= |
mod equals |