// example boolean expressions x > 2 0 <= y && y <= 10 ! (0 <= y && y <= 10 ) button.isVisible()A boolean expression evaluates to true or false. You can store it in a boolean variable e.g.
// storing a boolean expression in a variable boolean whether = x > 2;
// displaying a boolean variable on the console System.out.println( whether );You can use a boolean variable in an if later rather than
// referencing a boolean variable in an if if ( whether ) makeDate(); if ( ! whether && done() ) finish();
// ILLEGAL IN JAVA!! int is not the same as boolean int seen = button.isVisible(); if ( seen ) doSomething();
// boolean must be used in Java where in C you could use an int. boolean visible = button.isVisible(); if ( visible ) doSomething(); // or using an int with int-style syntax. int seen = button.isVisible() ? 0 : 1; if ( seen != 0 ) doSomething();
|
|
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/boolean.html | J:\mindprod\jgloss\boolean.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.179.210] | |
| Feedback | You are visitor number 58,260. | |