Multiple choice technology programming languages

class D { public static void main (String args[]) { Byte a = new Byte("1"); byte b = a.byteValue(); short c = a.shortValue(); char d = a.charValue(); int e = a.intValue(); long f = a.longValue(); float g = a.floatValue(); double h = a.doubleValue(); System.out.print(b+c+d+e+f+g+h); }} What is the result of attempting to compile and run the program?

  1. Prints: 7

  2. Prints: 7.0

  3. Compile-time error

  4. Run-time error

  5. None of the above

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

Byte class does not have a charValue() method. All other methods (byteValue, shortValue, intValue, longValue, floatValue, doubleValue) exist in the Byte class, but charValue() does not exist, causing a compile-time error.