A.1. Operator Precedence
Operators are shown in decreasing order of precedence from top to bottom (Fig. A.1).
Operator | Description | Associativity |
---|---|---|
++ | unary postfix increment | right to left |
-- | unary postfix decrement | |
++ | unary prefix increment | right to left |
-- | unary prefix decrement | |
+ | unary plus | |
- | unary minus | |
! | unary logical negation | |
~ | unary bitwise complement | |
( type ) | unary cast | |
* | multiplication | left to right |
/ | division | |
% | remainder | |
+ | addition or string concatenation | left to right |
- | subtraction | |
<< | left shift | left to right |
>> | signed right shift | |
>>> | unsigned right shift | |
< | less than | left to right |
<= | less than or equal to | |
> | greater than | |
>= | greater than or equal to | |
instanceof | type comparison | |
== | is equal to | left to right |
!= | is not equal to | |
& | bitwise AND | left ... |
Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.