Why all the methods in StringBuffer declared as Synchronized ? can any one explaine me clearly ?
posted 10 years ago
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.