posted 18 years ago
hi sandeep,
byte b=2;
b += 10; //1
b = b+10; //2
1 and 2 are not same thing.
1 is identical to b=(byte) b+10; works fine.
2 does not compile because b is converted to int (due to + operator) and after adding 10, the result(int) can not be assigned to byte value.