Possible Duplicate:
When Java evaluates a conjunction (<boolean exp1> && <boolean exp2>), does it eval exp2 if exp1 is false?
If I have 2 condition say, A and B and I type:
A && B
Are they both evaluated in parallel and only then it does AND?
For example, if I type A && false will it evaluate the A condition or it knows it will be false anyway?
And if it’s not done in parallel, does it start from the right or left?
(A && false VS false && A).
Thanks.
EDIT: Got it. Thanks to all!
no,
A is first evaluated and if A is false it skips evaluating B
if A is true then it checks if B is true
in this case, A is evaluated first and if A is false, it doesnt check the next condition(false). If A is true then false will be evaluated but as it is false the whole condition would be false.