-3

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 double(boolean was here, wrote by mistake...) I got an error, also don't know why. With char it works. I attached the photo below.

1 Answers1

0

"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.

Leaderboard
  • 371
  • 1
  • 10