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 declare the static variables and methods in an abstract class?
What is role of void keyword in declaring functions?
How do I print a “?
Can we declare a constructor as final?
What is meant by distributed application? Why are we using that in our application?
What is use of functional interface in java 8? Explain
What are the advantages and disadvantages of object cloning?
Is java type safe?
What is the difference between private & public & friendly classes?
How does java pattern compile work?
What does flagged out mean?
Can java list be null?
Is 64bit faster than 32 bit?
Is the empty set a singleton?
How to implement a multithreaded applet?