Answers

Question and Answer:

  Home  Analyst Integration

⟩ What is difference between & and && operator?

& is a bitwise operator while && is a logical operator. One difference between & and && is that bitwise operator (&) can be applied to both integer and boolean but logical operator (&&) can only be applied to boolean variabes. When you do a & b then AND operator is applied to each bit of both integer number, while in case of of a && b , second argument may or may not be evaluated, that's why it is also known as short circuit operator, at least in Java. I like this question and often asked it to junior or developer and college graduates.

 195 views

More Questions for you: