byte b1=10;
byte b2=20;
byte b3=b1+b2;
The above code causes Compile time error.
I understand byte,short and char is treated as int in an expression.
So, i changed the code as:
byte b1=10;
byte b2=20;
byte b3=(byte)(b1+b2);
(or)
byte b1=10;
byte b2=20;
int b3=b1+b2;
Please help me to understand why should it treated as int?
Can it perform addition on byte types itself?