Multiple choice technology programming languages

byte b; final int a = 10; final int x = a; b = x; System.out.println("The value of b is " + b);

  1. Compilation error

  2. Runtime Error

  3. 10

  4. None of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Since 'a' is a compile-time constant (final int), 'x' is also a compile-time constant with a value of 10. The compiler allows assigning 'x' directly to byte 'b' without an explicit cast because its value fits within the range of a byte.