String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 3/5

What does <code>"" + 1 + 2 + 3</code> produce?

  • A

    Compile error

  • B

    6

  • C

    123

    check_circle
  • D

    1.2.3

Explanation

Empty string forces concatenation; result is "123".

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

Related questions