operator
In Java, operators are special symbols that perform specific operations on one or more operands (variables or values). They are fundamental to writing code that performs calculations, comparisons, and logical evaluations
*Types of Operator *
- Arithmetic Operator
- Assignment Operator
- Relational Operator
- Logical Operator
- Bitwise Operator
- Ternary Operator
Arithmetic Operators in Java:
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. The following table shows the Types of Arithmetic Operators in Java:
Assignment Operators in Java:
Java assignment operator is used to assign the value on its right to the operand on its left. The following table shows the Types of Assignment Operators in Java.
Relational Operators in Java are also known as Comparison Operators. It determines the relationship between two operands and returns the Boolean results, i.e. true or false after the comparison. The following table shows the Types of Relational Operators in Java.
Logical Operators in Java:
Logical Operators in Java are mainly used in conditional statements and loops for evaluating a condition. They are basically used with binary numbers. The following table shows the types of Logical Operators in Java.
Bitwise Operators in Java:
The Bitwise Operators in Java perform bit-by-bit processing. They can be used with any of the integer types. The following table shows the Types of Bitwise Operators in Java.
Ternary Operator in Java:
Ternary Operator in Java is also known as the Conditional Operator. It is the shorthand of the if-else statement. It is the one-liner replacement of the if-else statement in Java. It is called ternary because it has three operands. The general format of the ternary operator is: Condition ? if true : if false
Top comments (0)