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 :-
- Unary Operator
- Binary Operator
- 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.
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);