Get Adobe Flash player

Saturday, January 14, 2012

Operators in Java

Operators operate on operands and cause changes in the operand value or give a new value. Java provides operators in four catagories.

  1. Arithmatic Operator
  2. Bitwise Operator
  3. Relational Operator
  4. Logical Operator

 

Arithmetic Operators:

 

Operation Operator Symbol
Add +
Subtract -
Multiply *
Divide /
Modulus %
 
Bitwise Operators:
 
Bitwise operators are used to manipulate individual bits of a data item. there are situations where individual bits of a data are to be modified. These operators operates only on byte, char, short, int and long types.
 
Operation Operator Symbol
Bitwise NOT ~
Bitwise AND &
Bitwise OR |
Bitwise XOR ^
Left Shift <<
Right Shift >>
Right Shift Zero Fill >>>

 

Relational Operators:

Operation Operator Symbol
Equal to ==
Not Equal to !=
Greater Than >
Greater than or equal to >=
Less than <
Less than or equal to <=

Logical Operators:

Operation Operator Symbol
Equal to ==
Logical AND &
Logical OR |
Logical XOR ^
Short-circuit AND &&
Short-circuit OR ||
Logical unary NOT !
Not equal to !=
Ternary if-else ?:

0 comments:

Post a Comment