Operator Precedence

Operators are evaluated in the following order:

  1. Parenthetical expression (innermost first)
  2. Unary positive, unary negative, ~, !
  3. <<, >>
  4. &, |, ^
  5. Multiplication, division, modulus
  6. Addition, subtraction
  7. <, <=, >, >=, ==, !=
  8. &&, ||

Operators with the same precedence are evaluated left to right.