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
PHP String Operator
Advertisements
difference between == and === operators?
Operator Precedence
The Unary Operators
Java bitwise OR "|" operator
Java Left Shift "<<" Operator
Java Right Shift ">>" Operator
Java "&" operator
PHP Array Operator
Core Java Interview Question, Interview Question
Java Operators
Operators In Java
precedence operators c++ example
Using Operators in JSP
Java Operators List
Unary Operators
Conditional (Logical) Operators
Other Operators in java 7
Java Training and Tutorials, Core Java Training
Best Java Tutorial for Beginners
Java Tutorial
Operators
Operators
Operators
Operators
Operators
Core Java Interview Question, Interview Question
Relational Operators in java 7
boolean comparisons - tutorial
Java XOR operator

Ads