java boolean to int code example
Example 1: java cast bolean to int
int result = myBooleanVar ? 1 : 0;
Example 2: convert boolean to int
int val = (bool) ? 1 : 0;
Example 3: can you add a bool and an int
Yes, as a bool is 1 (true) or 0 (false)