A.1. Operator Precedence

Operators are shown in decreasing order of precedence from top to bottom (Fig. A.1).

Figure A.1. Operator precedence chart.
OperatorDescriptionAssociativity
++unary postfix incrementright to left
--unary postfix decrement 
++unary prefix incrementright to left
--unary prefix decrement 
+unary plus 
-unary minus 
!unary logical negation 
~unary bitwise complement 
( type )unary cast 
*multiplicationleft to right
/division 
%remainder 
+addition or string concatenationleft to right
-subtraction 
<<left shiftleft to right
>>signed right shift 
>>>unsigned right shift 
<less thanleft to right
<=less than or equal to 
>greater than 
>=greater than or equal to 
instanceoftype comparison 
==is equal toleft to right
!=is not equal to 
&bitwise ANDleft ...

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.