Operators in Java

An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations. Operators are used in programs to manipulate data and variables. Java supports a rich set of operators.
Java operators can be classified into 8 categories are given as below :

1. Arithmetic Operators: Arithmetic Operators are used to constructing mathematical expressions as in algebra. Java provides all the basic arithmetic operators.

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Remainder

2. Relational Operators: When we compare two quantities and depending on their relation, then we used some relational symbol that is called Relational Operators.

OperatorMeaning
<less than
<=less than or equal to
>greater than
>=greater than or equal to
(==)equal to
!=not equal to

3. Logical Operators: An expression that combines two or more relational expressions is called Logical Operators or Compound Operators.

OperatorMeaning
&&logical AND
||logical OR
!logical NOT

4. Assignment Operators: Assignment Operators are used to assigning the value of an expression to a variable.

5. Increment and decrement operators : Java has two useful operators and these are the Increment and decrement operators.
+ + and – –

6. Conditional Operators: The character pair ?: is a ternary operator, it is used to construct conditional expressions that are called Conditional Operators.

7. Special Operators: Java supports some special operators such as instanceof opeartor and member of selection operator or dot operator (.) .

8. Bitwise Operators: Java has a distinction of supporting special operators that are known as Bitwise Operators. It is used to manipulate data at values of bit-level and also used for testing the bits or shifting them to the right or left. Bitwise Operators may not be applied to float or double data types.

OperatorMeaning
&bitwise AND
!bitwise OR
^bitwise exclusive OR
~One's Complement
<<Shift left
>>Shift right
>>>Shift right with zero fill