String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 2/5

String a = "Hello";
String b = "World";
System.out.println(a + " " + b);

What is printed?

  • A

    Hello+World

  • B

    HelloWorld

  • C

    Hello World

    check_circle
  • D

    Hello World

Explanation

The + operator concatenates the strings with a space in between.

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

Related questions