Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 4/5

<code>Integer x = 5;</code> works because of

  • A

    Compile error always

  • B

    Casting

  • C

    Autoboxing (int → Integer)

    check_circle
  • D

    Unboxing

Explanation

Autoboxing converts the int 5 to <code>Integer.valueOf(5)</code>.

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

Related questions