top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is difference between StringBuffer and StringBuilder in Java?

0 votes
76 views

I read many times but i doesn't know the difference some one help me to understood clearly ?

posted Dec 9, 2014 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

The difference between StringBuffer and StringBuilder are following:

StringBuffer is uses mutable String, all public methods are synchronized which makes it thread-safe but same time slow but In JDK 5 they provided StringBuilder which is copy of StringBuffer without synchronization.

StringBuilder is compatible with StringBuffer, but synchronization property is may not compatible.
StringBuilder is a little faster than StringBuffer.

answer Dec 10, 2014 by Karthick.c
...