What is the difference between the Boolean & operator and the && operator?

Hello,

What is the difference between the Boolean & operator and the && operator?

thanks,

View Answers

April 18, 2013 at 4:46 PM

hi friend,

boolean '&' operator is used for two operands or expressions it gives the result true only when both side operands or expressions are true otherwise, it returns false if any side of operand or expression is false it returns false. In this case both sides operands or expressions evaluated.

However, '&&' operator is used for two operands or expressions and gives the result true if both side operands or expressions are true. But, in this case only the left side operands are evaluated and the right side operands will not be evaluated if the left hand side operand is false and will leave that statement and read the next statement (if any).

For example and more detail please visit the link below may, this will be helpful for you.

http://www.roseindia.net/java/master-java/conditional-operators.shtml









Related Tutorials/Questions & Answers:
Advertisements