byte b=4; //valid byte c=5; //vaild byte d= b+c; //is invalid Pls explain why though the range of byte is -128 to 127
Jeroen T Wenting
posted 11 years ago
all integer mathematics will result in an int being returned unless you explicitly cast it to something else. So your last statement tries to assign an int value to a byte variable, where of course it won't fit.