Activity 2.2 - Experimenting with strings and concatenation
Topic
This activity gives you practise in the use of string concatenation and
escape sequences.
Materials
In addition to the discussion of the solution in the Solution document, the project
for this activity contains two classes:
- Ex2_2, incomplete at present;
- Main, which is run to test the code.
Task
You are asked to build two strings which, when printed, will result in the
following output:
Sherlock Holmes and Dr. Watson lived at No. 221B, Baker Street.
"ABC,
double-XYZ,"
she recited.
Instructions
- Run the project. You should find that to start with it simply prints the
message :
End of output.
- Now open the class Ex2_2 and read the method output. Follow the
instructions there.
- When you have made the required changes, run the project to test whether your
solution is correct.
- You might want to do the activity in stages, testing your output as you go.