byte b = 27;
but only because the compiler automatically narrows the literal value to a byte if it is a compile time constant.The preceding code is identical to the following:
byte b = (byte) 27;
byte b = 3; // No problem, 3 fits in a byte
byte c = 8; // No problem, 8 fits in a byte
byte d = b + c; // Should be no problem, sum of the two bytes fits in a byte
But this gives a compiler error since "b+c" is not a compiler time const.
In this case you have to exlicitly cast as
byte c = (byte) (a + b);
byte d = 3 + 8; // This compiles successfully, since 3+8 is a compiler time const