Objects: Instances of Classes

AP Computer Science A· difficulty 4/5

Common cause of NPE:

  • A

    Dividing by 1

  • B

    Accessing field/method on a null reference

    check_circle
  • C

    Print statement

  • D

    Comparing primitives

Explanation

<code>null.field</code> or <code>null.method()</code> always throws NPE.

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

Related questions