String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 2/5

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

  • A

    7 Hi

  • B

    Hi 52

    check_circle
  • C

    Hi 7

  • D

    Hi 5 2

Explanation

Left-to-right: "Hi " + 5 → "Hi 5"; + 2 → "Hi 52" (string concatenation, not addition).

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

Related questions