Priority | Operator | Use |
1 | [ ] | index of arrays |
( ) | calling methods | |
. | access members | |
2 | ++ | increment |
-- | decrement | |
+, - | unary add, subtract | |
~ | NOT (bitwise) | |
! | NOT (boolean / logical) | |
(type) | new type cast | |
(new) | new object | |
3 | *, /, % | multiplication, division, modulo (remainder) |
4 | +, - | addition, subtraction |
+ | concatination | |
5 | << | signed bit shift left |
>> | signed bit shift right | |
>>> | unsigned bit shift right | |
6 | <, <= | less than, less than or equal to |
>, >= | greater than, greater than or equal to | |
instanceof | calling/testing references | |
7 | = = | is equal to |
! = | is not equal to | |
8 | & | AND (bitwise and logical) |
9 | ^ | XOR (bitwise and logical) |
10 | | | OR (bitwise and logical) |
11 | && | Boolean AND |
12 | || | Boolean OR |
13 | ?, , , : | conditional statements |
14 | = | assignment |
*=, /=, +=, -= | combinated assignment | |
%= | combinated assignment | |
<<=, >>= | combinated assignment | |
&=,^=, |= | combinated assignment |
Reminder:
- Expressions within the parenthesis are first to be evaluated
- Nested Parenthesis are evaluated from the inner to the outer parenthesis.
- Higher precedence are done first before the lower precedence.