Page 1 of 1

What will be the error in the following Java code?

Posted: Wed Jul 13, 2022 7:45 pm
by answerhappygod
byte b = 50;
b = b * 50;
a) b cannot contain value 50
b) b cannot contain value 100, limited by its range
c) No error in this code
d) * operator has converted b * 50 into int, which can not be converted to byte without casting