Java precedence
| Level | Operator | Description | Associativity |
|---|---|---|---|
| 16 | [] . () | access array element access object member parentheses | left to right |
| 15 | ++ -- | unary post-increment unary post-decrement | not associative |
| 14 | ++ -- + - ! ~ | unary pre-increment unary pre-decrement unary plus unary minus unary logical NOT unary bitwise NOT | right to left |
| 13 | () new | cast object creation | right to left |
| 12 | * / % | multiplicative | left to right |
| 11 | + - + | additive string concatenation | left to right |
| 10 | << >> >>> | shift | left to right |
| 9 | < <= > >= instanceof | relational | not associative |
| 8 | == != | equality | left to right |
| 7 | & | bitwise AND | left to right |
| 6 | ^ | bitwise XOR | left to right |
| 5 | | | bitwise OR | left to right |
| 4 | && | logical AND | left to right |
| 3 | || | logical OR | left to right |
| 2 | ?: | ternary | right to left |
| 1 | = += -= *= /= %= &= ^= |= <<= >>= >>>= | assignment | right to left |
Resource: https://introcs.cs.princeton.edu/java/11precedence/
Comments
Post a Comment