what is difference between String buffer and String builder?

Answer Posted / subhareddy

There is no much difference between string buffer and string
builder.only thing is all the methods available in string
buffer class are synchronized methods.and the method
available in string builder class are non-synchronized methods.
If we want thread safety then we have to go for string
buffer ,but performance goes down.if we don't want thread
safety the we can go for string builder

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you start a thread?

543


Can we force garbage collector to run ?

566


Why arraylist is used in java?

547


Is null a string in java?

552


Do we need to manually write Copy Constructor?

602






What is the numeric promotion?

495


Are arrays passed by reference in java?

481


Tell us something about different types of casting?

517


Can inner class be public in java?

546


What is the main advantage of passing argument by reference?

497


List the different types of classloaders in java.

498


Can we overload run() method in java?

592


Explain about the dynamic behavior of core java?

628


What is the exact difference in between Unicast and Multicast object?

1504


what is synchronization and why is it important? : Java thread

584