String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 3/5

<code>String s = "Hi"; s + "!"</code> is equivalent to

  • A

    s.append("!")

  • B

    s.push("!")

  • C

    s.add("!")

  • D

    s.concat("!")

    check_circle

Explanation

<code>+</code> on Strings invokes <code>concat</code> semantics (returns a new String).

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

Related questions