• Main Menu
  • Java Operators


    Java Operator Operator Description
    [ ] Array index
    () Method call
    . Member access
    ++ Prefix or postfix increment
    -- Prefix or postfix decrement
    + - Unary plus, minus
    ~ Bitwise NOT
    ! Boolean (logical) NOT
    (type) Type cast
    new Object creation
    * / % Multiplication, division, remainder
    + - Addition, subtraction
    + String concatenation
    << Signed bit shift left to right
    >> Signed bit shift right to left
    >>> Unsigned bit shift right to left
    < <= Less than, less than or equal to
    > >= Greater than, greater than or equal to
    instanceof Reference test
    == Equal to
    != Not equal to
    & Bitwise AND
    & Boolean (logical) AND
    ^ Bitwise XOR
    ^ Boolean (logical) XOR
    | Bitwise OR
    | Boolean (logical) OR
    && Boolean (logical) AND
    || Boolean (logical) OR
    ? : Conditional
    = Assignment
    *= /= += -= %= <<= >>= >>>= &= ^= |= Combinated assignment (operation and assignment)

    Java Operator Precedence

    Java operator precedence is how Java determines which operator to evaluate first.

    In this chart, operator precedence is displayed from highest precedence to lowest precedence.

    Priority Operator Operation Order of Evaluation
    1 [ ] Array index Left to Right
    () Method call
    . Member access
    2 ++ Prefix or postfix increment Right to Left
    -- Prefix or postfix decrement
    + - Unary plus, minus
    ~ Bitwise NOT
    ! Boolean (logical) NOT
    (type) Type cast
    new Object creation
    3 * / % Multiplication, division, remainder Left to Right
    4 + - Addition, subtraction Left to Right
    + String concatenation
    5 << Signed bit shift left to right Left to Right
    >> Signed bit shift right to left
    >>> Unsigned bit shift right to left
    6 < <= Less than, less than or equal to Left to Right
    > >= Greater than, greater than or equal to
    instanceof Reference test
    7 == Equal to Left to Right
    != Not equal to
    8 & Bitwise AND Left to Right
    & Boolean (logical) AND
    9 ^ Bitwise XOR Left to Right
    ^ Boolean (logical) XOR
    10 | Bitwise OR Left to Right
    | Boolean (logical) OR
    11 && Boolean (logical) AND Left to Right
    12 || Boolean (logical) OR Left to Right
    13 ? : Conditional Right to Left
    14 = Assignment Right to Left
    *= /= += -= %= <<= >>= >>>= &= ^= |= Combinated assignment (operation and assignment)

    Notes

    • Expressions inside parentheses are evaluated first
    • Nested parentheses are evaluated from the innermost parentheses to the outermost parenthesis.
    • Operators in the same row in the chart have equal precedence.

    Got Something To Say:

    Your email address will not be published. Required fields are marked *

    Java
    179 queries in 0.536 seconds.