I understand why the following is wrong:
byte a = 3;
byte b = 8;
byte c = a + b; // compile error
It won\'t compile. Expressions alway
3 and 8 are compile time constants.Therefore, at the time of compilation happens, compiler can identify that 3 + 8 can fit into a byte variable.
If you make your a and b to final (constant) variable. a + b will become a compile time constant. Therefore, it will compile without any issue.
final byte a = 3;
final byte b = 8;
byte c = a + b;