| Author |
Regarding StringBuffers and StringBuilders
|
praveen raaj
Greenhorn
Joined: Nov 30, 2009
Posts: 11
|
|
Hi Friends,
can you explain to me what is the common use for StringBuffers and StringBuilders?
|
 |
Patel Chintan
Ranch Hand
Joined: Mar 01, 2007
Posts: 80
|
|
Hi,
The only difference between StringBuffer and StringBuilder is that StringBuilder is unsynchronized whereas StringBuffer is synchronized. So when the application needs to be run only in a single thread then it is better to use StringBuilder. StringBuilder is more efficient than StringBuffer.
|
Chintan Patel, SCJP1.5, http://datewithjava.blogspot.com
|
 |
Neha Daga
Ranch Hand
Joined: Oct 30, 2009
Posts: 504
|
|
|
StringBuffer and StringBuilder classes are both used to create mutable string objects which is not possible with String class the only difference between the two is already stated by chintan.
|
SCJP 1.6 96%
|
 |
Afzal Rehman
Ranch Hand
Joined: Dec 16, 2009
Posts: 35
|
|
StringBuffer is syncronized
StringBuilder is unsyncronized.
StringBuffer and StringBuilder are mutable.
StringBuilder was added in java 5 API it's same as StringBuffer except is not thread safe
StringBuilder is faster then StringBuffer as performance point of view.
|
SCJP 6.0
|
 |
Phungsuk Wangdu
Ranch Hand
Joined: Nov 04, 2009
Posts: 114
|
|
well common use could be if we want mutable string objects
and both are used as an alternative to stiring
|
 |
 |
|
|
subject: Regarding StringBuffers and StringBuilders
|
|
|