Introduction
Operators in Java programming language are special symbols that perform specific operations on one, two, or three operands, and then return a result.
An operator is a symbol (or symbols) that tells a Java program to perform an operation on one, two or three operands. An operator and its operands form an expression (see the Expressions topic). The operands of an operator are themselves expressions.
This topic describes the 40 or so distinct operators defined by Java. The separate Expressions topic explains:
- how operators, operands and other things are combined into expressions,
- how the expressions are evaluated, and
- how expression typing, conversions, and expression evaluation work.
-
The Arithmetic Operators (+, -, *, /, %)
-
The Assignment Operators (=, +=, -=, *=, /=, %=, <<=, >>= , >>>=, &=, |= and ^=)
-
The Bitwise and Logical Operators (~, &, |, ^)
-
The Conditional Operator (? :)
-
The conditional-and and conditional-or Operators ( && and || )
-
The Equality Operators (==, !=)
-
The Increment/Decrement Operators (++/--)
-
The Instanceof Operator
-
The Lambda operator ( -> )
-
The Relational Operators (<, <=, >, >=)
-
The Shift Operators (<<, >> and >>>)
-
The String Concatenation Operator (+)