A

Admin • 802.91K Points
Coach

Q. What is the result of the following Java code: byte a = 10; byte b = 20; byte c = a + b;

  • (A) 30
  • (B) Compile-time error
  • (C) Runtime error
  • (D) 1024

Explanation by: Admin
a + b results in an int, so explicit casting is needed to assign to a byte.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.