Java Operators

In this chapter you will learn:

  1. What are the four groups of Java operators
  2. What is the Precedence for Java Operators

Four groups of Java operators

Java operators can be divided into the following four groups:

  • arithmetic,
  • bitwise,
  • relational,
  • logical.

Operators are classified as prefix, postfix, and infix.

  • A prefix operator is a unary operator that precedes its operand, for example -6.
  • A postfix operator is a unary operator that trails its operand, for example x++.
  • An infix operator is a binary or ternary operator that is placed between the binary operator's two or the ternary operator's three operands, for example x + 5.

Java Operator Precedence

The following table shows the order of precedence for Java operators, from highest to lowest.

  1. () [] . (Highest)
  2. ++ - - ~ !
  3. * / %
  4. + -
  5. > >>> << ]]>
  6. >= < <= ]]>
  7. == !=
  8. ^
  9. |
  10. ||
  11. ?:
  12. = op= (Lowest)

Next chapter...

What you will learn in the next chapter:

  1. Use Java Arithmetic Operators to do calculation
  2. How to use basic arithmetic operators to do calculation
  3. How to use modulus operator to get the remainder of a division operation
  4. How to use arithmetic compound assignment operators
  5. How to use Java increment and decrement operators
Home » Java Tutorial » Operators Statements
Your first Java program
Your second Java program
Java Keywords and Identifiers
Variable stores value in a Java program
Variable Scope and Lifetime
Java Operators
Java Arithmetic Operators
Java Bitwise Operators
Java Relational Operators
Java Boolean Logical Operators
Java If Statement
Java switch Statement
Java while Loop
Java for loop
Java for each loop
Java break statement
Java continue statement
Java return statement
Java Comments
Java documentation comment(Javadoc)