What is the differnence between String Buffer and String
builder despite having knowledge that String builder is
faster than String Buffer and last one is threadsafe.please
tell another important difference.
Answer Posted / vinodkumar uttara student
StringBuilder all methods are not synchronized , nothing
changes done in this class , it is same as StringBuffer.I
mean to say , more than one thread can be execute
StringBuilder object , because there is not a concept of
lock on object , any thread can execute on this object.Where
as StringBuffer class all methods are synchronized only one
thread at time can access synchronized method , because it
get lock on object.
Please help me , if i am right?
is it correct,
thanks for the reply
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Can string be considered as a keyword?
What is data movement?
Can we have more than one package statement in the source file?
What are scriptlets?
Who developed java?
What are three types of loops in java?
Name few "optional" classes introduced with java 8 ?
Explain the importance of thread scheduler in java?
Is it necessary that each try block must be followed by a catch block?
What is binary tree in java?
If try block is successfully executed, Then Is Finally block executed?
Is there a case when finally will not execute?
What is the final variable?
What is the exact difference in between Unicast and Multicast object?
How to perform quicksort in java?