Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 2/5

Integer x = 7;
int y = x + 3;
System.out.println(y);

What is printed?

  • A

    10

    check_circle
  • B

    7

  • C

    37

  • D

    73

Explanation

The Integer x is auto-unboxed to int 7 when used in arithmetic, so y = 7 + 3 = 10.

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

Related questions