Types of Operators in Java:

  1. Arithmetic Operators
  2. Bit-wise Operators
  3. Logical Operators
  4. Relational Operators 
  5. Assignment Operators
  6. Misc Operators



Java operator precedence

java order of operations

Arithmetic Operators
  • Arithmetic operators are used in mathematical expressions.
  • Following are the arithmetic operators in java.
  1. +  :  Addition
  2. -   : Subtraction
  3. *  : Multiplication
  4. /   : Division
  5. % : Modulus

Bit wise Operators:

  • Bit wise operators operates on individual bits of operands.
  • Following are the Bit-wise operators in java. 
  • Bitwise operators in java

  1. ~      : Bit wise unary not
  2. &     : Bit wise And
  3. |       : Bit wise OR
  4. ^      : Bit wise Exclusive OR
  5. >>    : Shift Right
  6. >>>  : Shift right zero fill
  7. <<    :Shift left

Logical Operators:

  1. && : Logical AND
  2. ||      : Logical OR
  3. !      : Logical NOT

Relational Operators in java

  1. ==  : Equal to
  2. !=   : Not Equal to
  3. <    : Less Than
  4. >    : Greater Than
  5. >=  : Greater Than or Equal to
  6. <= : Less Than or Equal to

Assignment Operators:

  1. =    : Simple Assignment
  2. +=  : Add and assign
  3. -=   : Subtract and assign
  4. *=   : Multiply and assign
  5. %=  : Modulus and assign
  6. /=    : Divide and assign
  7. &=   : Bit wise AND assignment
  8. |=     : Bit wise assignment OR
  9. ^=    : Bit wise Exclusive OR assignment
  10. >>= : Shift Right assignment
  11. >>>= : Shift right  zero fill assignment
  12. <<=   : Shift left assignment


Misc Operators:

Increment and Decrement operators:
  1. ++ : increment
  2. --   : decrement


Conditional Operator: (?:)

  • Also known as ternary operator
  • Example: int a= 1>2?1:2;

Ternary operator in java


Instanceof Operator
  • Instance of operator is used to test whether that object is belong to that class type or not.
  • If that object belongs to that class it returns true .otherwise it returns false.
  • Instance of operator is also known as comparison operator.because it compares with the instance of type.
Instanceof operator in java

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu