Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get the length of the string.
Java
String text = "Hello"; int length = text.[1]();
🎯 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 letters.
Java
String word = "java"; String upper = word.[1]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the code to check if the string starts with "Hi".
Java
String greeting = "Hi there!"; boolean starts = greeting.[1]("Hi");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to extract the substring "cat" from the word "concatenate".
Java
String word = "concatenate"; String part = word.[1](3, [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 trimmed spaces and replaced spaces with underscores.
Java
String messy = " hello world "; String clean = messy.[1]().[2](" ", [3]);
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
