Java OCA OCP Practice Question 197

Question

Which of the following statements are true?

Choose all correct options.

  • A. StringBuilder encapsulates a mutable string.
  • B. StringBuilder is thread safe.
  • C. StringBuffer is thread safe.
  • D. StringBuffer is generally faster than StringBuilder.


A, C.

Note

StringBuilder is nearly identical to StringBuffer.

The main differences are that StringBuilder is not thread safe, and its methods are generally faster than those of StringBuffer.




PreviousNext

Related