String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 3/5

What does <code>5 + 2 + " items"</code> produce?

  • A

    Compiler error

  • B

    52 items

  • C

    7 items

    check_circle
  • D

    5 2 items

Explanation

Left-to-right: 5 + 2 → 7 (numeric addition); 7 + " items" → "7 items".

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

Related questions