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" ); }
| You can get the freshest 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 | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.103] | |
| Feedback | You are visitor number 11. | |