String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 4/5

<code>"score: " + obj</code> where obj is null prints

  • A

    score: null

    check_circle
  • B

    score: 0

  • C

    score:

  • D

    Throws NullPointerException

Explanation

String concatenation with null reference produces "null".

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

Related questions