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

Ads
 

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

Ads









Related Tutorials/Questions & Answers:
Java 'or' operator
difference between == and === operators?
Advertisements
Operator Precedence
Java bitwise OR "|" operator
Java "&" operator
Core Java Interview Question, Interview Question
Java Operators
Operators In Java
precedence operators c++ example
Unary Operators
Java Operators List
Java Operators List
Java Operators List
Java Operators List
Java Operators List
Conditional (Logical) Operators
Other Operators in java 7
Java Training and Tutorials, Core Java Training
Best Java Tutorial for Beginners
Java Tutorial
Operators
Operators
Core Java Interview Question, Interview Question
boolean comparisons - tutorial
Relational Operators in java 7
Deadlock
Java XOR operator
Auto Increment and Decrement
O - Java Glossary
right and left shift operators
Java Program

Ads