Task 1 of 15 · 0 solved · 15 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

1.5 Strings — joining with +

Lesson

Strings

A String is text in double quotes: "Hello". This module is about joining strings and combining them with numbers.


Joining strings with +

The + operator between strings joins them (concatenation). No space is added for you — any spaces must be inside the quotes.


Worked example

System.out.println("Hello" + "World");     // HelloWorld
System.out.println("Hi" + " " + "there");   // Hi there

▶ Try it: run this, then change something and run it again.



What does "Hello" + "World" print?


Type exactly what this prints:

System.out.println("Hi" + " " + "there");

Which expression prints exactly cat dog (with a space)?


Match each expression to what it prints.