The operators are shown in decreasing order of precedence from top to bottom. Operators in the same group have the same precedence, and their associativity is shown in the table.
Operator | Name | Associativity |
---|---|---|
() | Parentheses | Left to right |
() | Function call | Left to right |
[] | Array subscript | Left to right |
. | Object member access | Left to right |
++ | Postincrement | Right to left |
“ “ | Postdecrement | Right to left |
++ | Preincrement | Right to left |
“ “ | Predecrement | Right to left |
+ | Unary plus | Right to left |
“ | Unary minus | Right to left |
! | Unary logical negation | Right to left |
(type) | Unary casting | Right to left |
new | Creating object | Right to left |
* | Multiplication | Left to right |
/ | Division | Left to right |
% | Remainder | Left to right |
+ | Addition | Left to right |
“ | Subtraction | Left to right |
<< | Left shift | Left to right |
>> | Right shift with sign extension | Left to right |
>>> | Right shift with zero extension | Left to right |
< | Less than | Left to right |
<= | Less than or equal to | Left to right |
> | Greater than | Left to right |
>= | Greater than or equal to | Left to right |
instanceof | Checking object type | Left to right |
== | Equal comparison | Left to right |
!= | Not equal | Left to right |
& | (Unconditional AND) | Left to right |
^ | (Exclusive OR) | Left to right |
(Unconditional OR) | Left to right | |
&& | Conditional AND | Left to right |
Conditional OR | Left to right | |
?: | Ternary condition | Right to left |
= | Assignment | Right to left |
+= | Addition assignment | Right to left |
“= | Subtraction assignment | Right to left |
*= | Multiplication assignment | Right to left |
/= | Division assignment | Right to left |
%= | Remainder assignment | Right to left |