Is conditional and operators and logical and operators same.
Operators in java
‘Logical AND’ Operator(&&): condition1 && condition2
The && and || operators perform Conditional-AND and Conditional-OR operations on two boolean expressions.
From the above 2 statements we can say they are the same.
Don’t see the operators as logical or conditional. Instead think of it as “bitwise vs. conditional” rather than “logical vs conditional” since the general concept of “logical” applies in both cases.
Bitwise
x & y // bitwise AND, 0101 & 0011 = 0001
x | y // bitwise OR, 0101 | 0011 = 0111
Conditional
x && y // true if both x and y are true
x || y // true if either x or y are true
Prime number question
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.