Operator in JAVA

Operator in JAVA

Operator in JAVA:-

The operator is the symbol that performs a specific operation on one, two and three operands and returns a result. Operator in JAVA is a symbol that tells to the compiler to perform a certain manipulation. It is for manipulate data and variables.

Java support total 44 no. of operators.

Mainly operator can be classified in 3 different ways :-

  1. Unary Operator
  2. Binary Operator
  3. Ternary Operator

UNARY OPERATOR :-

The unary operator require only one operand.

 +  –  ++   —  ~  !

BINARY OPERATOR :-

Binary Operator returns the greater of two elements according to the specified Comparator.

  Arithmetic operator :- +  –  *  /  %

  Bitwise operator      :- &  |  ^

  Logical operator       :- &&  ||

  Relational operator  :- >  <  >=  <=  !=  ==

  Shift operator            :- >>  <<  >>>u

  Assignment operator :- +=   -=  * =  /=  %=  >>=  <<=  >>>=  &=  |=  ^=  =

TERNARY OPERATOR :-

Java ternary operator is the only conditional operator that takes three operands.

?:

SPECIAL OPERATOR :- . []  ()  instanceof typecasting

INSTANCEOF :- This operator is use to check the object existence.

  • child class object  is  also the object of parent class  but the object of parent  class can’t be access the resources of child , in other word the object of parents class is not the object of child.

Example

Class demo

{

}

Class text   extend demo

{

Public static void main (string I I args)

{

test t1=new Test();

Demo d1=new Demo();

System.out.println(t1 instanceof Test);

System.out.println(d1 instanceof Test);

}

}

 

basicittopic

basicittopic

A Computer Science Study for IT students and people of IT community

2 thoughts on “Operator in JAVA

  • August 16, 2018 at 6:49 pm
    Permalink

    Very shortly this web site will be famous among all blog people, due to it’s fastidious content

    Reply

Leave a Reply