In this article we will see 'What are available Operators in Java ', and how to use them with example.

Java has almost all operators useful in calculation, logic building and conditions, these operators can be divided into following broad categories:

1) Arithmetic operators

+  adds two operands
-  subtract second operands from first
*  multiply two operand
/  divide numerator by denumerator
%  remainder of division
++  Increment operator increases integer value by one
--  Decremented operator decreases integer value by one

2) Relation operators

==  Check if two operand are equal
!=  Check if two operand are not equal.
>  Check if operand on the left is greater than operand on the right
<  Check operand on the left is smaller than right operand
>=  check left operand is greater than or equal to right operand
<=  Check if operand on left is smaller than or equal to right operand

3) Logical operators

&&  Logical AND (a && b) is false
||  Logical OR (a || b) is true
!  Logical NOT (!a) is false

4) Bitwise operators

&  Bitwise AND
|  Bitwise OR
^  Bitwise exclusive OR
>>  left shift
<<  right shift

5) Assignment operators

=  assigns values from right side operands to left side operand a = b
+=  adds right operand to the left operand and assign the result to left a+=b is same as a=a+b
-=  subtracts right operand from the left operand and assign the result to left operand a-=b is same as a=a-b
*=  multiply left operand with the right operand and assign the result to left operand a*=b is same as a=a*b
/=  divides left operand with the right operand and assign the result to left operand a/=b is same as a=a/b
%=  calculate modulus using two operands and assign the result to left operand a%=b is same as a=a%b

In this article we have seen 'What are available Operators in Java', and how to use them with example. In upcoming articles we will see more about Java.
  • By Techburps.com
  • Nov 7, 2017
  • Core Java