Difference between Boolean & operator and the && operator

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

The Boolean && operator is used for determining two relational expressions and returns true if only if both returns true, otherwise returns false

The Boolean & operator is used to perform Boolean operations on bits of two given arithmetic expressions

Example: 5 & 6 will return 5. 5 and 6 will be converted into their binary equivalents 101 and 110 respectively. Now the comparison occurs for corresponding place value bits – 1 and 0, 0 and 1 and 1 and 1. This comparison returns 100, i.e. equivalent to 5.

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

A & B
In this, both the operands A as well as B are evaluated and then ‘&’ is applied to them.

A && B
In this, A is evaluated first. If A is true then B is evaluated and then the operand is applied to them. If A is false, evaluation of B is skipped.
What is a task's priority and how is it used in scheduling?
A priority is an integer value. Based on this priority the scheduler determines when to execute a task.....
Difference between preemptive scheduling and time slicing
In time slicing methods, a task executes for a predefined slice of time......
What is synchronization and why is it important?
Threads communicate by sharing access to fields and the objects......
Post your comment