Multiple choice technology programming languages

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

  1. Prints: 0xFFFF,0xFFFF,false

  2. Prints: 0xFFFF,0xFFFF,true

  3. Prints: -1,-1,false

  4. Prints: -1,-1,true

  5. Compile-time error

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

Double(0xFFFF) creates a Double object with value 65535.0. When converted to byte or short, the value is -1 due to overflow. The sum of e+f+g+h equals 4*65535, so the expression evaluates to true. The output is -1,-1,true.