info@meritcampus.com    +91-85006-22255
...
`

Siva Nookala - 17 Feb 2019
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.
• Literals e.g., `15`, `20.0`, `true`
• Variables e.g., `a`, `bonus`, `marks`
• Expressions e.g., `17 / 2`, `a + bonus`, `marks * 3`

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.
Operator Group Usage Examples
Java Arithmetic Operators Used in mathematical expressions `+ - * / -- ++`
Java Bitwise Operators act upon the individual bits of their operands `~ & | >> << >>>=`
Relational Operators In Java determines the relationship that one operand has to the other `== != > < >= <=`
Boolean Logical Operators In Java are used only on `boolean` operands `& | ^ && &= ^=`
Assignment Operator In Java is the single equal sign ('=') `=`
Ternary Operator In Java is used as if then else statement `?:`

2-min video about operators in Java

0
Wrong
Score more than 2 points