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
What is the difference between choice and list?
What is floor math?
When is update method called?
How does hashset works in java?
what is a working thread? : Java thread
What is difference between add() and addelement() in vector?
What are functions in java?
Can the garbage collection be forced by any means?
How do you square a number in java?
Which java version is latest?
Explain 5 io best practices?
How can I become a good programmer?
What is the use of default method in interface in java?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
What’s the difference between the methods sleep() and wait()?