Operators in Java Language?

Four Types of Operators in Java Language and these are:

  1. Arithmetic.
  2.  Bitwise.
  3. Boolean.
  4. Relation Operators.

 Arithmetic Operators:

Operands must be numeric type of arithmetic operators.
We can not use these operators as a Boolean Type but we can us them as a char type.

 These operators are:

       Operators                       Results

            +                                  Addition
           -                                     Subtraction
          *                                       Multiplication
           /                                        Division
          %                                      Modulus
          ++                                    Increment
           --                                    Decrements
           +=                                  Addition Assignment
           -=                                   Subtraction Assignment
            *=                                 Multiplication Assignment
             /=                                  Division Assignment
           %=                               Modulus Assignment

Bitwise Operators:

These operators applied to integer type like:
  • long
  • short
  • int 
  • char
  • byte
These Operators act upon individual bits of their operands.

These operators are:

 Operators                     Results


      ~                            Bitwise unary Not

     &                              Bitwise AND

      |                                  Bitwise OR


      ^                        Bitwise exclusive OR
    >>                          Shift Right
    >>>                         Shift Right Zero Fill
     <<                        Shift Left
     &=                       Bitwise AND Assignemnt
      |=                        Bitwise OR Assignment
   ^=                         Bitwise exclusive OR Assignment
    >>=                    Shift Right Assignment
   >>>=                   Shift Right Zero Fill Assignment
   <<=                      Shift Left Assignment

Relation Operators:

The Relation Operators Determine the Relationship that one operand has to the other. They Determine the equality and ordering.

These operators are:


 Operators                 Results

       ==                      Equal to
        !=                      Not Equal to
        >                       Greater then
        <                        Less then
        >=                     Greater then or Equal to
        <=                     Less then or Equal to

Boolean Logical Operators:

These operators operate only on Boolean operands. All the binary logical operators combine two Boolean values to form a resultant Boolean value.

These operators are:

         Operators                     Results
&
Logical AND
|
Logical OR
^
Logical XOR (exclusive OR)
||
Short-circuit OR
&&
Short-circuit AND
!
Logical unary NOT
&=
AND assignment
|=
OR assignment
^=
XOR assignment
==
Equal to
!=
Not equal to
?:
Ternary if-then-else
     
     




Comments

Popular posts from this blog

Inheritance in Java

Type Casting or Conversion in Java