Operator precedence

4.3 Operator precedence Certain operators have higher priorities than others. Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. for example, the dot operator has higher precedence than the any other operator. Precedence 15 () Parentheses [] Array subscript · Member selection Precedence 14 ++ Unary post-increment -- Unary post-decrement Precedence 13 + Unary plus - Unary minus ++ Unary pre-increment -- Unary pre-decrement ! Unary logical negation ~ Unary bitwise complement (type) Unary type cast Precedence 12 * Multiplication / Division % Modulus Precedence 11 + Addition - Subtraction Precedence 10 << Bitwise left shift >> Bitwise right shift with sign extension >>> Bitwise right shift with zero extension Precedence 9 < Relational less than > Relational greater than <= Relational less than or equal >= Relational greater than or equal instanceof Type comparison (objects only) Precedence 8 == Relational is equal to != Relational is not equal to Precedence 7 & Bitwise AND Precedence 6 ^ Bitwise exclusive OR Precedence 5 | Bitwise inclusive OR Precedence 4 && Logical AND Precedence 3 || Logical OR Precedence 2 ? : Ternary conditional Precedence 1 = Assignment += Addition assignment -= Subtraction assignment *= Multiplication assignment /= Division assignment %= Modulus assignment

Comments

Popular Posts