Answers

Question and Answer:

  Home  Full Stack Developer (Java)

⟩ Explain me what is the difference between String, StringBuffer andStringBuilder?

String is an immutable class. In older JDK’s the recommendation when programmatically building a String was to use StringBuffer since this was optimized to concatenate multiple Strings together. However, the methods on StringBuffer were marked as sychronized, which meant that there was a performance penalty, hence StringBuilder was introduced to provide a non-synchronized way to efficiently concatenate and modify Strings.

 142 views

More Questions for you: