jAva
"OPERATORS"
An operator is a special symbol that tells the compiler to perform a specific
mathematical or logical operation
from one or more operands ,where the operands may be an expression ..
types:--
1.Basic arthmetic operators
2.Assignment operators
3.increment or decrement operators
4.Logical operators
5.Relational operators(comparision operators)
6.Bitwise operators
7.ternary operators.. --> if statement
ARTHMETIC:-
+ , - , * , / , %
-----------------------------------------------------------------------------------
------------
Assignment operators:--
it is used in java to assign values
= , += , -=, *= , /=, %=
= -> simple assignment operators
Assign th values from right side operands to left side operands
+= -> Add And assignment operators.
it adds right side operands to the left side operands and assign the
result to left side
-= -> Subtract And assignment operators
it subtract right side operands with the left side operands and assign the
result to left side
*= -> Muliplication assignment operators.
it multiply right side operands withthe left side operands and assign the
result to left side
/= -> Divide And assignment operators
it divide left side operands with the right side operands and assign the
result to left side
%= -> Modulus And assignment opertors
it takes modulus using two operators and assign the resukt to the left
side operands
-----------------------------------------------------------------------------------
----------------
3.INCREMENT OR DECREMENT OPERATORS:-
++ increment (increases value of the one operands by 1)
-- decrement (decreases value of the one operands by 1)
postFix (a++, a--) eg: a+1 = 1 / a-1 = 1
prefix (++a,--a) eg: 1+a=1 / 1-a = 1
-----------------------------------------------------------------------------------
------------------
LOGICAL OPERTORS:--
It is used to check whether the conditions is true or false
&& , || ,!=
Logical And (&&) :-
if all the conditions is true , it will result true
if any one condition is false it results false
true && true = true
True&& false = false
False && true = false
False && false = False
Logical OR (||):-
if anyone conditions is true , it will result true
if all condition is false it results false
true ||true = true
True || false = true
False ||true = true
False ||false = False
Logial NOT(!):-
if the two conditions is false it results true., remains false
-----------------------------------------------------------------------------------
---------
RELATIONAL OPERATORS
to check the relations between two operands
== , != , > , < , >= , <=
== -> return true if both side are equal
!= -> return true if left side is is not equals to right
> -> return true if left side is greater than right
< -> return true if left side is lesser than right
>= return true if left side is greater or equal to right
<= return true if left side is lesser or equal to right
-----------------------------------------------------------------------------------
------------------
BITWISE OPERATORS:--
(Binary Numbers 0, 1) (Decimal 0 to 9)
used to perform the operation on individual bits
<< left shift
>> right shift
>>>insigned right shift
& AND
| OR
^ Bitwise exclusive OR (EXOR)
~ bitwise complement (Bitwise Not)
-----------------------------------------------------------------------------------
---------------------
TERNARY OPERATORS:--
like as conditonal operators..
syntax--> (condition ) ? "{true}" : "{false}"
-----------------------------------------------------------------------------------
---------------------