The Priority or Precedence in which the operators are to be performed is known as operator precedence. The associativity specifies the operators direction to be evaluated, it may be left-to-right or right-to-left.
Rank | Category | Operator | Associativity |
---|---|---|---|
Bracket | () , [] | Left to Right | |
Unary | ++, -- | Right to left | |
Multiplicative | * , / , % | Left to right | |
Additive | + , - | Left to right | |
Bitwise shift | << , >> , >>> | Left to Right | |
Relational | < , <= , > , >= | Left to right | |
Equality | == , != | Left to right | |
Logical AND | && | Left to right | |
Logical OR | || | Left to right | |
Conditional | ? : | Right to left | |
Assignment | = , += , -= , *= , /= , %= | Right to left |