Site Search:

java operators and its precedences




From higher precedence on top, the order of java operator (OCAJP scope) precedence are:

  1. Post-unary operators                               x++, x--
  2. Pre-unary operators                                ++x, --x
  3. Other unary operators                             +, -, !
  4. Multiplication/Division/Modulus           *,/,%
  5. Addition/Subtraction                              +, -
  6. Relational operators                               <,>,<=,>=
  7. Equal to/not equal to                              ==, !=
  8. Logical operators                                   &, ^, |
  9. Short-circuit logical operators               &&, ||
  10. Ternary operators                                   boolean expression ? expression1 : expression2
  11. Assignment operators                            =, +=, -=