Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 3/5

Double d = 4.5;
double r = d * 2;
System.out.println(r);

What is printed?

  • A

    9.0

    check_circle
  • B

    4.5

  • C

    9

  • D

    8.5

Explanation

d is auto-unboxed to double 4.5; multiplying by 2 yields 9.0.

Want 10 more like this — adaptive to your weak spots?

Related questions