• Post Reply Bookmark Topic Watch Topic
  • New Topic

StringBuffer  RSS feed

 
suneel kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why all the methods in StringBuffer declared as
Synchronized ? can any one explaine me clearly ?
 
Arjun Karthick
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
StringBuffer have there method synchronized to provide thread safety. if you dont feel to have thread safety then you can go for StringBuilders. it's methods are not synchronized and so it can be faster than stringbuffer as it does not have the over head of synchronization.

Karthick.j.g
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!