Java OCA OCP Practice Question 1059

Question

The following line of code is valid.

int x = 9; byte b = x; 
  • A. True
  • B. False


B.

Note

The integer value of x cannot be automatically converted to a byte.

The assignment of the variable x to the variable b would require an explicit cast.

This cast could result in a loss of data.




PreviousNext

Related