Is there any reason why Java booleans take only true or false why not 1 or 0 also?
true
false
1
0
Java, unlike languages like C and C++, treats boolean as a completely separate data type which has 2 distinct values: true and false. The values 1 and 0 are of type int and are not implicitly convertible to boolean.
boolean
2.1m questions
2.1m answers
60 comments
57.0k users