🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.String with +
  2. B.StringBuffer
  3. C.StringBuilder
  4. 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 →