A blog for computer science passionates.

Wednesday, 18 March 2020

Java: Operators Part-5 More Operators

Hello Friends!!!
Today we are going to learn more operators. In one of my previous articles, I have mentioned that Java is rich and powerful in the matter of Operators.
Some Operators such as,


.(Dot)   
This operator is used as a member access operator.
+ This operator is also used as a string concatenation operator.
[ ]
Square brackets are used to define the size of the operator.
instanceof This operator is used to check the object is defined in the class or not.
+=
Arithmetic addition and assign to the variable, for example, a+=b
-= Arithmetic subtraction and assign to the variable, for example, a-=b
*=
Arithmetic multiplication and assign to the variable, for example, a*=b
/= Arithmetic division and assign to the variable, for example, a/=b
%=
Arithmetic modules and assign to the variable, for example, a%=b
&= Bitwise AND and assignment
|=
Bitwise OR and assignment
^= Bitwise exclusive OR assignment
>>=
Shift right with assignment
>>>= Shift right zero fill assignment
<<=
Shift left with the assignment


These are more operators available in Java. That's it with the operators in Java. Let's take an example of instanceof operator.


Try this example and check the output.

No comments:

Post a Comment