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 / sanjay
WHEN AN APPLICATION NEEDS TO BE RUN ONLY BY SINGLE THREAD
IT IS BETTER TO USE STRING BUILDER BECAUSE IT IS
UNSYNCHRONIZED
WHEN AN APPLICATION NEEDS TO BE RUN BY MULTIPLE THREADS IT
IS BETTER TO USE STRING BUFFER BECAUSE IT IS SYNCHRONIZED
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
Does java allow default arguments?
What is a java predicate?
What will happen to the exception object after exception handling?
Explain java coding standards for methods?
What is meant by tab pans?
What is difference between static and abstract class?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
How do I enable java in safari?
What are the main differences between the java platform and other platforms?
What are the difference between string, string builder, and string buffer in java?
What is extension method in java?
Which collection does not allow duplicates in java?
What are the states of thread in java?
Can we have more than one package statement in the source file?
When we should use serialization?