false && false → false
false && true → false
true && false → false
true && true → true
The evaluation is guaranteed to proceed in strict left to right order, and if any boolean is false, it does not evaluate any expressions to the right of that. This lets you write code like this:
// if s is null, Java won't try to test the length of s if ( s != null && s.length() > 0 ) { out.println( "non empty string" ); }
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.58] | |||
| You are visitor number 11. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/jgloss/mccarthyandoperator.html | J:\mindprod\jgloss\mccarthyandoperator.html | ||