Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 4/5

<code>Integer i = 7; int n = i + 1;</code> involves

  • A

    Casting

  • B

    Autoboxing only

  • C

    Compile error

  • D

    Unboxing (Integer → int)

    check_circle

Explanation

<code>i</code> is unboxed to int 7, then 7 + 1 = 8.

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

Related questions