Thursday, 24 February 2011

Operators used in java

Java provides rich operator enviroment. Most of it's operartors can be divided into the following four groups: Arithmetic, bitwise, relational and logical.

Arithmetic operators:
Arithmetic operators are used in mathematical expressions in same awy as they are used in algebra.
The following table lists the arithmetic operators:

Arithmetic Operators in java

The operands of the arithmetic operators must be of numeric type. you cannot use them on Boolean types, but you can use them on  char types. Since the char type in java is subset of int type.

Bitwise Operators:
Java defines several bitwise operators which can be applied to integer types, long,int,short,char and byte. These operators act upon individual bits of their operands.
They are summarized in following table:
                                                                                  Bitwise Operators in Java
Relational Operators:
The relational operators determine the relationship that one operand has to the other. Specifically they determine equlatity and ordering . The relational operators are shown here:

                                                                       Realationa Operators in Java
The outcome of these operators is a boolean value. The relational operators are most frequently used in the expressions that control the if statement and the various loop statements.
  Boolean Logical Operators:
The Boolean logical opertators are shown here operate only on boolean operands. All of the binary logical operators combine two boolean values to form a resultant boolean value.

Boolean Logical operators

No comments:

Post a Comment