Javatpoint Logo

what does synchronization mean in terms of stringbuilder and stringbuffer class?

By: Pratik*** On: Sat Mar 11 19:52:21 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
what does synchronization mean in terms of stringbuilder and stringbuffer class?Up0Down
core java  x  328Tags

 
Image Created0Down

By: [email protected] On: Sat Mar 11 21:57:28 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
Difference between Stringbuffer and StringBuilder is that
StringBuffer is Synchronized and by default thread safe and having lower performance compare to StringBuiler.
and StringBuilder is not Synchronized and also not thread safe But having high performance.

means when there are more that one threads want to access same resource at same time then it will create condition like deadlock this happened when there is no synchronization.
in synchronization 1 thread wait until other thread completes it's process means there is negotiation between threads about time to access particular resource this process is called synchronization.

Synchronized is used to lock an object for any shared resource and it automatically acquires the lock for that resource and releases it when the thread completes its task.

I hope you clear the concept now if you have doubt you can contact me at : [email protected]
Image Created0Down

By: [email protected] On: Sun Mar 19 09:34:44 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No