1 Operators
1 Operators
Result:
11 increased value:11
Result:
10 increased value:11
2.decrement operator:
---------------------
a)pre decrement:(--x) value is first decreased & new value will be printed
----------------
ex:-
x=10;
--x;
System.out.print(x);
Result:
9 decreased value:9
Result:
10 decreased value:9
Ex:-
x=true;
x=!y;
System.out.print(x);
Result
False.
Airthmetic operators
-------------------------
Assignment Operator
-----------------------
syntax:
variable= value;
compound operator
-------------------
+= for adding left operand with righ operand and then assigning it to variable on
the left.
-= for subrtacting left operand with righ operand and then assigning it to the
variable on the left.
*= for multiplying left operand with righ operand and then assigning it to the
variable on the left.
/= for dividing left operand with right operand and then assigning it to variable
on the left.
%= for assigning modulo of left opernad with righ operand and then assigning it to
variable on the left.
Relational Operator
----------------------
== Equal to
!= Not Equal to
Logical Operator
-------------------
A B &&
true false false
false true false
true true true
false false false
b)|| OR operator
A B ||
true true true
false true true
true false true
false false false
condition A B XOR
true true False
true false true
false true true
false false false
2.Binary operators:
3.Ternary operator: