Operators in Java - Types of Operators in Java
Operators in Java - Types of Operators in Java
Operator in Java is a symbol that tells the compiler to perform some operation. Java provides a rich set of operators to deal with various types of functions. Sometimes we need to perform arithmetic operators, then use the plus (+) operator, multiply(*) for multiplication, etc.
There are many operators in Java programming language. Some of them are +, -, *, /, %, ==, >, <, >=, <=
Let us take a look at all operators one by one.
1) + operator: + is used to add two numbers.
The following program displays the output as 16
public class Addition {
2) - operator: - is used to subtract two numbers.
The following program displays the output as 4.
public class Subtraction {
3) * operator: * is used to multiply two numbers.
The following program displays the output as 2.
public class Multiplication {
4) / operator: / is used to divide two numbers.
The following program displays the output as 2.
public class Division {
5) % operator: % is used to determine the remainder of the division of two numbers.
The following program displays the output as 0.
Types of Operators in Java
- Arithmetic Operators in Java
- Relational Operators in Java
- Bitwise Operators in Java
- Logical Operators in Java
- Conditional Operators in Java
- Assignment Operators in Java
Comments
Post a Comment