Multiple choice

Which of the following is a thread safe class in Java?

  1. StringBuffer

  2. ArrayList

  3. HashMap

  4. StringBuilder

  5. String

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

StringBuffer is designed to be thread safe and all public methods in StringBuffer are synchronized.