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
Can we define private and protected modifiers for the members in interfaces?
How can I become a good programmer?
How many digits is int32?
What is the syntax and characteristics of a lambda expression? Explain
Do I need to import java.lang package any time? Why?
Is jdk required on each machine to run a java program?
What is the difference between == and === javascript?
How can we avoid including a header more than once?
What is difference between equals and hashcode method?
Difference between string, stringbuffer and stringbuilder?
Which sorting algorithm is in place?
What is a lambda expression ? What's its use ?
What are the differences between heap and stack memory in java?
What is annotation in java?
Why deletion in linkedlist is fast than arraylist?