byte num1 = 5;
byte num2 = 6;
byte res = num1 + num2;
//Adding bytes asks for a explicit cast to int - "Cannot Implicitly Convert 'int' to 'byte'
This can be justified by assuming the case that what if the arithmetic operation causes an overflow. So if this is going to be the case then what for int?
int num1 = 2;
int num2 = 4;
int res = num1 + num2;
// This works, but when we take the previous assumption to consideration here
// here int may also lead to overflow right
So this should also throw a cast error right, it should ask for long and the chain continues right?
There already another stackoverflow question similar to this but it is not answering this question. byte + byte = int... why?