operator is used to perform some mathematical operations.
Eg:
x=1,y=2;
X + Y
Here x and y are called operand.
+ are called operators.
That is, the + operation works on x and y. Let us assume that the value of x is 1 and the value of y is 2.
The + operator adds these two together and gives us 3.
These are called operand and operator.
Classification of operators:
Unary operator
Binary operator
Ternary operator
Unary operator:
Unary operators are operators that operate on only one operand.
Eg:
++(increment operator)
++a
--(decrement operator)
--a
Binary operator:
Operators that operate using two operands are binary operators.
Eg:
+,-,%,…etc
a+b;
Ternary operator:
Operators using three operands are ternary operators.
It is also known as conditional operator.
(expression 1)?(expression 2):(expression 3);