what is difference between String buffer and String builder?

Answer Posted / rajujohn

hi All
Both are mutable ,that means we can change value of the
instance variable using append,insert and ...
But only one difference when you go for the multi-thread
concept you use StringBuffer,Because it is thread safe ,that
means, if one thread access this stringbuffer variable on
the time another thread cant access this stringbuffer,so
stringbuffer is slowest performance compare to stringbuilder.

by raju.j

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is hash table in java?

494


a thread is runnable, how does that work? : Java thread

513


From the two, which would be easier to write: synchronization code for ten threads or two threads?

615


What is the difference between post and put?

538


What is java full form?

532






Can we modify the throws clause of the superclass method while overriding it in the subclass?

549


Is upper case in java?

531


What is the difference between break and continue statements?

549


What is the return type of the main method?

577


What is equals method in java?

524


Explain the importance of import keyword in java?

526


How do you escape a string?

508


What does += mean coding?

515


Does importing a package imports its sub-packages as well in java?

554


How do you define a parameter?

583