Howdy ranchers,
Piotr Milewski wrote
But... byte is smaller and narrower than char.
Therefore the compiler checks, if the char provided fits into a byte. The method would not compile if the line was final char c=500;
By the way, byte is both: bigger
and smaller than char.
byte b =
-12;
char c = b; no compile, explicit cast required
and
char c = 500;
byte b = c; no compile, the other way round.
Making the variable of the second lines of these examples final wouldn't help, as they both won't fit in.
Yours,
Bu.