Objects: Instances of Classes

AP Computer Science A· difficulty 4/5

<code>Dog d; d.bark();</code> (without initialization) at the local-variable level

  • A

    Calls bark

  • B

    Compile error (local must be initialized)

    check_circle
  • C

    Throws NPE

  • D

    Returns null

Explanation

Local variables must be definitely assigned before use.

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

Related questions