boolean pass = true;
pass = pass && test1();
pass = pass && test2();
It is NOT equivalent to the following:
boolean pass = true;
pass &= test1();
pass &= test2();
Because the
&=
operator is not short circuited. It compiles and works just fine for booleans, but it is a bitwise operator at heart and only works for booleans out of sympathy. What we need is a
&&=
operator.
No comments:
Post a Comment