< Java Tutorial

Java operators

← Previous Next →


Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups −

  • Arithmetic Operators
  • Relational Operators
  • Bitwise Operators
  • Logical Operators
  • Assignment Operators

The Arithmetic Operators

Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra.

The Relational Operators

Relational Operators Shows the relation among variable eg.>,<,==,<=,>= etc.

The Bitwise Operators

Java defines several bitwise operators, which can be applied to the integer types, long, int, short, char, and byte.
Bitwise operator works on bits and performs bit-by-bit operation.

The Logical Operators

Logical Operators check logic among variable.java provide types of logical operator eg. &&,||,! etc.

 Following table shows types of Java Operator

Operators Precedence
postfix expr++ expr--
unary ++expr --expr +expr -expr ~ !
multiplicative  * / %
additive  ;+ -
shift << >> >>>
relational < > <= >= instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR  ||
 ternary   ? :
assignment = += -= *= /= %= &= ^= |= <<= >>= >>>=
← Previous Next →