Java Operators

Quiz : https://take.quiz-maker.com/Q0RGYPNVR 

Java Operators

  • Java operators are used to perform mathematical and logical operations.
  • They also used to perform operations on variables and values.
int x = 20;
int y = 10;
                            int c = x + y;//OUT PUT:30
  • "+" is a operator which is performing adding operation on x variable and y variable.
There are several types of operators in Java
  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Bitwise operators

  • Arithmetic operators : Used to perform mathematical operations.

  • Assignment operators : Use to assign the value to variable.


  • Comparison operators : Use to compare two values.

  • Logical operators : Use for a decision making and also used to check is expression is true or false

x=1 
                         
 AND: x < 5 && x < 10(true)
          x > 5 && x > 10(false)

OR: x < 5 ||  x < 10 (true)
      x < 5 || x > 10  (true)
      x > 5 ||  x < 10 (true)
       x > 5 ||  x > 10 (false)

NOT: x!=10(true)
       x!=1(false)


  • Bitwise operators : Used to perform a specific task.














Comments