Operators in java

 

Operator

  • It is a special symbol which is used to perform logical or mathematical operation on data or variable.

Operand

  • It is a data or variable on which the operation is to be performed.

Types of Operator

  • ⇒Arithmetic Operators
  • ⇒Relational Operators
  • ⇒Logical Operators
  • ⇒Assignment Operators
  • ⇒Increment/Decrement Operators

Arithmetic Operators

Arithmetic operators are used to perform arithmetic operations on variables and data.

Symbol

Operation

Example

+

Addition

x+y

-

Subtraction

x-y

*

Multiplication

x*y

/

Division

x/y

%

Modulus

x%y


Relational Operators

Relational Operators in Java are used to compare two variables for equality, non-equality, greater than, less than, etc. Java relational operator always returns a boolean value – true or false. 


Logical Operators

Logical operators are used to check whether an expression is true or false . They are used in decision making.











Assignment Operators

Assignment operators are used in Java to assign values to variables.













Increment/Decrement Operators


Increment and decrement operators are unary operators that add or subtract one, to or from their operand, respectively.




















Post a Comment

0 Comments