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
Name few java 8 annotations ?
What is byte data type?
Explain the difference between hashmap and hashtable in java?
What are the two ways to create a thread?
What is difference between static and final?
Can we overload the main() method?
How do you check if two given string are anagrams?
Which programming language is best in future?
What is the meaning of 3 dots in java?
What is the use of singleton class?
How many types of string data types are there?
What does the @override annotation do?
Can we store variables in local blocks?
Is age a discrete variable?
What one should take care of, while serializing the object?