| Precedence |
Operator |
Operand
Types
|
Associativity |
Operation |
1
(Highest) |
++
--
+
-
~
!
(type) |
arithmetic
arithmetic
arithmetic
arithmetic
integral
boolean
any |
Right-to-Left |
pre- or post- increment
pre- or post- decrement
unary plus
unary minus
bitwise complement (unary)
logical complement (unary)
cast |
| 2 |
*
/
% |
arithmetic
arithmetic
arithmetic |
Left-to-Right |
multiplication
division
remainder (modulus) |
| 3 |
+
-
+ |
arithmetic
arithmetic
string |
Left-to-Right |
addition
subtraction
string concatenation |
| 4 |
<<
>>
>>> |
integral
integral
integral |
Left-to-Right |
left shift
right shift with sign extension
right shift with zero extension |
| 5 |
<
<=
>
>=
instanceof |
arithmetic
arithmetic
arithmetic
arithmetic
object, type |
Left-to-Right |
less than
less then or equal
greater than
greater than or equal
type comparison |
| 6 |
==
!=
==
!= |
primitive
primitive
object
object |
Left-to-Right |
equal (have identical values)
not equal (have different values)
equal (refer to same obect)
not equal (refer to different objects) |
| 7 |
&
& |
integral
boolean |
Left-to-Right |
bitwise AND
boolean AND |
| 8 |
^
^ |
integral
boolean |
Left-to-Right |
bitwise XOR
boolean XOR |
| 9 |
|
| |
integral
boolean |
Left-to-Right |
bitwise OR
boolean OR |
| 10 |
&& |
boolean |
Left-to-Right |
conditional AND |
| 11 |
|| |
boolean |
Left-to-Right |
conditional OR |
| 12 |
?: |
boolean, any, any |
Right-to-Left |
conditional (ternary) operator |
13
(Lowest)
|
=
*=
/=
%=
+=
-=
<<=
>>=
>>>=
&=
^=
|= |
variable, any |
Right-to-Left |
assignment
assignment with operation |