Wrapper Classes: Integer and Double

AP Computer Science A· difficulty 4/5

<code>Integer a = 200; Integer b = 200; a.equals(b)</code> is

  • A

    true (compares values)

    check_circle
  • B

    Throws NPE

  • C

    false (always)

  • D

    Compile error

Explanation

<code>Integer.equals</code> compares the wrapped int values.

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

Related questions