Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new StringBuilder object.
Java
StringBuilder sb = new [1]();🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to append the string "Hello" to the StringBuffer object.
Java
StringBuffer sb = new StringBuffer(); sb.[1]("Hello");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the code to convert StringBuilder to String.
Java
StringBuilder sb = new StringBuilder(); sb.append("Test"); String result = sb.[1]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to create a StringBuffer, append "Hi", and convert to String.
Java
StringBuffer sb = new [1](); sb.[2]("Hi"); String s = sb.toString();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a StringBuilder, append "Bye", and convert to String.
Java
StringBuilder [1] = new StringBuilder(); [1].[2]("Bye"); String result = [1].[3]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
