Java OCA OCP Practice Question 596

Question

When a byte is added to a char, what is the type of the result?

  • A. byte
  • B. char
  • C. int
  • D. short
  • E. You can't add a byte to a char.


C.

Note

Byte, short, and char operands are widened to ints before the addition is performed.

The result type is the same as the operands: int.




PreviousNext

Related