That's right. Both && and || in Java "short-circuit": they do not evaluate their right-hand-side if their left-hand-side makes it pointless.
In (a && b), b will only be evaluated if a is true
In (a || b), b will only be evaluated if a is false
This is to allow precisely the code you quote, where evaluating b would be fatal if a is false.
This idea goes back to the language BCPL in about 1970, one of the direct ancestors of C, C++ and Java.
Thanks for the clarification, iau. That will certainly eliminate some white-space in my code (and make it more readable)!
If a equates to true, Java will never try to evaluate b. What would the point be??? As soon as one is true, the condition is passed!
In reference to your example. B will be evaluated when a!=1, however, as soon as a=1, b won't be evaluated during that iteration.
Oh my bad - I misunderstood what he was saying, thanks.