Operators are special symbols that perform specific operations on operands and find the result. e.g.,
+, -, *, >, <=, ! . These operators help in performing operations like arithmetic operations, boolean logical operations, relational operations,assignment operations, bitwise and ternary operations.
In the expression
25 + 17 , 25 and 17 are the operands where as + is the operator. So for addition operation, the operator used is + and it needs two operands.
Depending upon the operation the number of operands will be different. It could be 1 or 2 or 3 operands. For addition it is 2 operands, for unary minus it is only one operand and for ternary operator it requires 3 operands.
These operands should be one of the following.
The data type of operands is also important for operations. For some operations like addition and subtraction, only numeric data types are supported and for some operations like logical AND, only boolean data types are supported. The details of the operators and the corresponding data types are mentioned in those sections. Java supports the following operator groups.
|