Java Operators is a symbol used to perform operations. For example +, -, *, / etc.
There are many types of operators in java which helps to perform the certain operations. Some types of operators are listed below :
- Unary Operator
- Arithmetic Operator
- Shift Operator
- Relational Operator
- Logical Operator
Example of Arithmetic Operators
package practice_04;
public class ArithmeticOperators {
public static void main(String[] args)
{
int number1 = 6, number2 = 5;
int sum = number1 + number2;
System.out.println("The sum of numbers is: " + sum);
int sub = number1 - number2 ;
System.out.println("The subtraction of numbers is: "+ sub);
int mul = number1*number2;
System.out.println("The product of numbers is :"+ mul);
double div = number1/number2;
System.out.println("The value of division is : " + div);
double rem = number1%number2;
System.out.println("The remainder value is :"+ rem);
}
}