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:
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:
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.