I was wondering why Java doesn\'t allow casting from a boolean to an int, like so:
boolean foo = true; int bar = (int)foo;
This can be done
Because Java is strongly typed, a boolean and an int are two completely different data typesand one can not be casted to the other - it can not be casted, in fact.
boolean
int are two completely different data types