Why do I have to cast 0 to byte
when the method argument is byte
?
Example:
void foo() {
bar((byte) 0);
}
void bar(byte val) {}
I know that if the argument is of type long I don't have to cast it, so I'm guessing that Java thinks of mathematical integers as integers runtime.
Doesn't it discourage the usage of byte/short?