Analyst Integration Question:

What is difference between & and && operator?

Tweet Share WhatsApp

Answer:

& 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.

Download Integration Programmer PDF Read All 87 Integration Programmer Questions
Previous QuestionNext Question
How much time it take to retrieve an element if stored in HashMap, Binary tree and a Linked list? how it change if you have millions of records?What is the difference between a value type and a reference type?