In C and C++, true is represented by any integer other than
0
, and false is represented by 0
. In such languages,
the value of the Boolean expression n != 0
is false
if and
only if the value of n
is 0
.
Accordingly, the following while
statement is legitimate in those
languages, but is not accepted by Java:
while (n) { // BUG! Will not work in Java! ... }