enter image description hereExample:
sout(OxBD);
Output: 189
I don’t really understand why does compiler converts different representation of a number to integer. Why not boolean? When I try to cast to boolean I got an error, also don’t know why. With char it works.
I attached the photo below.
>Solution :
"0xBD" is an integer, which explains why it’s converted to hexadecimal by Java. You can’t convert to boolean, as 189 isn’t something that can be converted to boolean (which can store only two values, 0 and 1).
189 can be stored as a char though; what you get is the ASCII character representation of 189.