← Quiz: Java Strings: all 10 questions
Quiz: Java Strings · Question 3 of 10
Which is the fastest choice to build a long string in a single-threaded loop?
Which is the fastest choice to build a long string in a single-threaded loop?
- A.String with +
- B.StringBuffer
- C.StringBuilder
- D.String.concat
Answer & explanation
Correct answer: StringBuilder
StringBuilder is mutable and not synchronized, so it is the fastest.
Can you get the rest right without peeking?
Take the timed Quiz: Java Strings quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →