Thursday, 3 July 2014

What is the Difference between StringBuffer and StringBuilder?

StringBuffer:

  1. In StringBuffer, Every method is Synchronized.
  2. StringBuffer object is thread safe. Because StringBuffer object can be accessed only one thead       at time.
  3. Relatively performance is low compare to StringBuilder.

StringBuilder:

   1. In StringBuilder no mehtod is Synchronized.
   2. StringBuilder is not Thread safe. Because it can be accessed multiple threads simultaneously.
   3. Relatively performance is high compare to StringBuffer.

java4suresh.blogspot.in

No comments:

Post a Comment