Java Tutorials

100+ tutorials, explanation videos, and examples to help you develop creative and technical skills.

Operators in Java

Operators are symbols that we use to perform certain operations in java. For example, ‘+’ symbol is used to perform addition, and ‘-’ is used to perform subtraction. These symbols have pre-defined meanings.

Operators can be divided into 6 parts. :-

1. Arithmetic Operators

2. Assignment Operators

3. Relational Operators

4. Logical Operators

5. Unary Operators

6. Bitwise Operators

1. Arithmetic Operators

Arithmetic Operators are used to perform mathematical operation on variables. For example.

In above example, ‘+’ symbol is used to add two values.
All the Arithmetic Operators are listed below.

2. Assignment Operators

‘=’ symbol is used as assignment operator. It is used to assign a value to a variable.

3. Relational Operators

Relational Operators are used to check relation between two operands.

In above example, a > b is an expression.

All the Relational Operators are listed below:-

Example of Relational Operators

Greater Than Equals To (>=) operator is a combination of two operators (Greater Than and Equals To). JVM first check if Exp1 > Exp2 returns true then JVM don’t check for Equals To operator and if it returns false then JVM also check for Equals To operator and if both return false then Greater Than Equals To return false.

Less Than Equals To (<=) operator is a combination of two operators (Less Than and Equals To). JVM first check if Exp1 < Exp2 returns true then JVM don’t check for Equals To operator and if it returns false then JVM also check for Equals To operator and if both return false then Less Than Equals To return false.

4. Logical Operators

Logical Operators are used to check multiple expressions (relations) in a single expression. For example, ‘a > b’ is a single expression and in Logical Operator we can combine multiple expressions. Logical Operators are used in decision making.

All the Logical Operators are listed below

Example of Logical Operators

Working of above Program

If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com

Follow us to learn Coding and get in touch with new Technologies.