0
0
Javaprogramming~15 mins

String vs StringBuilder in Java - Interactive Practice

Choose your learning style8 modes available
ads_clickPractice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new StringBuilder object.

Java
StringBuilder sb = new [1]();
🎯 Drag options to blanks, or click blank then click option
AString
BStringBuilder
CStringBuffer
DStringBuilderBuilder
Attempts:
3 left
2fill in blank
medium

Complete the code to append text to a StringBuilder.

Java
sb.[1]("Hello");
🎯 Drag options to blanks, or click blank then click option
Aadd
Bconcat
Cappend
Dinsert
Attempts:
3 left
3fill in blank
hard

Fix the error in converting StringBuilder to String.

Java
String result = sb.[1]();
🎯 Drag options to blanks, or click blank then click option
AtoString
BtoStr
Cstringify
Dconvert
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a StringBuilder and append text.

Java
StringBuilder [1] = new [2]();
[1].append("World");
🎯 Drag options to blanks, or click blank then click option
Asb
BStringBuilder
Cstr
DString
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to build a string and convert it to String.

Java
StringBuilder [1] = new [2]();
[1].append("Hi");
String [3] = [1].toString();
🎯 Drag options to blanks, or click blank then click option
Abuilder
BStringBuilder
Ctext
DStringBuffer
Attempts:
3 left