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

  1. Arithmetic Operators in Java 
  2. Relational Operators in Java
  3. Bitwise Operators in Java
  4. Logical Operators in Java
  5. Conditional Operators in Java
  6. Assignment Operators in Java
Source: LearnVern

Comments

Popular posts from this blog

What is Data Type in Java?

What is Core Java - Features of Java Programming