Types and Forms of Operators


Types and Forms of Operators

We use Operators to perform operations on variables and values. Operators are represented by symbols. The variables and values on which operators perform operation are called operands. Let’s look at this code snippet:

int x = a + 10;

Here, plus sign is the operator, the variable a and the literal value 10 are operands.

Forms of Operators

Depending on the number of operands an operator operates upon, we classify them into 3 forms:

  1. Unary
  2. Binary
  3. Ternary

Unary Operators work on a single operand, binary on 2 operands and ternary on 3 operands. Most of the operators in Java are binary, a few are unary. There is only one ternary operator in Java.

Types of Operators

Based on the type of operation performed by the operator, we can group them into the following types:

  1. Arithmetic
  2. Relational
  3. Logical
  4. Assignment
  5. Bitwise

We will look at Arithmetic, Relational, Logical and Assignment type of operators. As Bitwise operators are not included in ICSE syllabus, so they are out of scope for this course.