Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new string by adding " World" to the original string.
Java
String greeting = "Hello"; String newGreeting = greeting[1]" World";
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to convert the string to uppercase.
Java
String text = "hello"; String upperText = text.[1]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the code to correctly replace "cat" with "dog" in the string.
Java
String animal = "cat"; String newAnimal = animal.[1]("cat", "dog");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to create a new string with "Java" repeated 3 times.
Java
String repeated = "Java".[1](3); String result = repeated.[2]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a new string with the first 4 characters of "immutable" in uppercase.
Java
String word = "immutable"; String part = word.[1](0, [2]); String result = part.[3]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
