+ 3
What is Different between && and & in java?
2 Answers
+ 3
&& is logical operator
& is bitwise operator
edit:
hope these helps..
https://www.sololearn.com/discuss/449238/?ref=app
https://www.sololearn.com/discuss/2431376/?ref=app
https://www.sololearn.com/discuss/271619/?ref=app
+ 2
&& -> Logical AND returns True or False
& -> Boolean AND returns a number
example:
1. 5>0 && 6<4 will return False
2. 5&4 will return 4
How? Convert to binary first and perform bitwise AND
1 0 1 (5)
1 0 0 (4)
--------
1 0 0 (4)
--------