what is difference between String buffer and String builder?

Answer Posted / subhareddy

There is no much difference between string buffer and string
builder.only thing is all the methods available in string
buffer class are synchronized methods.and the method
available in string builder class are non-synchronized methods.
If we want thread safety then we have to go for string
buffer ,but performance goes down.if we don't want thread
safety the we can go for string builder

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the scope or life time of class variables or static variables?

520


Are floats faster than doubles?

566


What is default constructors?

543


What is a list in java?

508


What is a jagged array in java?

537






What is an image buffer?

541


why Java does not support multiple inheritances?

704


When will we use them?

599


What is an immutable class? How to create an immutable class?

540


What is square root in java?

588


What is the benefit of singleton pattern?

529


What is the purpose of a volatile variable?

559


What is the statements?

593


What is enhanced loop in java?

550


What is a condition in programming?

560