What will be the error in the following Java code?
byte b = 50;
b = b * 50;
byte b = 50;
b = b * 50;
A. b cannot contain value 100, limited by its range
B. * operator has converted b * 50 into int, which can not be converted to byte without casting
C. b cannot contain value 50
D. No error in this code
Answer: Option B
Related Questions on Data Types and Variables
What is the maximum value that can be stored in a byte variable in Java?
A. 127
B. 255
C. 32767
D. 64
What is the default value of an int variable in Java if it's not explicitly initialized?
A. 0
B. 1
C. -1
D. Null
Which of the following is not a valid identifier for a Java variable?
A. my_var
B. _myVar
C. 3rdVar
D. $var
Join The Discussion