on Leave a Comment

Operators in Java

Java has rich set of operator to manipulate variables. To perform mathematical operation on data, operators are necessary. 

Java operators are classified into following categories:

(1) Arithmetic operator
(2) Relational operator
(3) Logical operator
(4) Bitwise operator
(5) Conditional operator
(6) Assignment operator
(7) Misc operator

Arithmetic Operators

Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. 

Here is a list of arithmetic operators, assume A = 3, B = 2.

Arithmetic operators in java


Relational Operators

Relational operators are mainly used in decision making statements.

This table shows relational operators,


Relational operators in java

Logical Operators

This table shows list of logical operators,


Logical operators in java


Bitwise Operators

This table shows the list of bitwise operators,



Assignment Operators

This table shows the list of assignment operators supported by java.


Assignment operators in java

Miscellaneous Operators

There are some other operators supported by java.

Conditional Operators

Conditional operator is also known as ternary operator. 

Syntax:

expression1 ? expression2 expression3

If expression1 is true, then expression2 otherwise expression3.

instanceOf Variable

This operator is used for object reference variables. The operator checks whether the object is of class type or interface type.


0 comments:

Post a Comment