Sunteți pe pagina 1din 1

JJ A

AVVA
A Bitwise,

OPERATOR Logical &


Assignments

BITWISE OPERATOR:
Bitwise operators are used to perform
manipulation ofindividual bits of a
number. They can be used with anyof the
integral types (char, short, int, etc). They
are usedwhen performing update and
query operations of binary indexed tree.
Bitwise OR (|) – It takes two equal-length binary representations and
performs the logicalAND operation on each pair of the
corresponding bits, which is equivalent to multiplyingthem. Thus, if

&
both bits in the compared position are 1, the bit in the resulting
binaryrepresentation is 1 (1 × 1 = 1); otherwise, the result is 0 (1 × 0 =
0 and 0 × 0 = 0).
Bitwise AND (&) – There are two types of AND operators in Java: the logical && and
thebinary &. Binary & operator work very much the same as logical && operators works,

^
except itworks with two bits instead of two expressions. The "Binary AND operator" returns
1 if bothoperands are equal to 1.
Bitwise XOR (^) –It stands for "exclusive OR" and means "one or the other", but not both.
The"Binary XOR operator" returns 1 if and only if exactly one of its operands is 1. If both
operandsare 1, or both are 0, then the result is 0.

LOGICAL OPERATOR:
The Java Logical Operators work on
the Booleanoperand. It's also called
Boolean logicaloperators. It operates
on two Boolean values,which return
Boolean values as a result.

II
Logical OR (ll) - It is only evaluated as
true when one of its operands
evaluates true. Ifeither or both
expressions evaluate to true, then the
result is true

&&
Logical AND (&&) - If both operands are
true then only"logical AND
operator"evaluate true.

!
Logical NOT (!) - It is a Unary Operator, it operates on single
operands. It reverses thevalue of operands, if the value is true,
then it gives false, and if it is false, then it givestrue

ASSIGNMENTOPERATOR:

=
The Java Assignment Operators
are used whenyou want to assign a
value to the expression.The
assignment operator denoted by
the single equal sign " = " .

EExxaam
mpplleess
public class ChainAssign {
public static void main(String args[]) {
int a, b, c;
Java also has the facility of
a = b = c = 100; // set a, b, and c to 100
chainassignment operators,
where wecan specify a System.out.println("a = " + a);

single value formultiple System.out.println("b = " + b);

variables. System.out.println("c = " + c);


}
}

S-ar putea să vă placă și