Sep 13, 2013

Internals Of Logical AND Logical OR in Java

Logical AND(1st condition && 2nd condition)-

Internals of Logical AND and Logical OR:Lets describe What is the internal mechanism of Logical AND and Logical OR.Logical AND is a Logical operator in java which returns a boolean value. If first condition false then in Logical AND, pointer does not check second condition. For second condition we use Bitwise AND.

 Logical OR(First condition || 2nd condition)-

Logical OR is also a Logical Opeartor which returns a boolean value. In Logical OR If first condition is true then pointer does not check 2nd condition . For check 2nd condition we use Bitwise OR.
For example-
Logical OR java         
int x= 10 && 20; 



Logical AND javaint y= 10 & 20;

Both operator Bitwise AND and Logical AND use with condition  but Logical AND does not use without condition. Bitwise AND use with and Without condition.