what is difference between String buffer and String builder?

Answer Posted / rajujohn

hi All
Both are mutable ,that means we can change value of the
instance variable using append,insert and ...
But only one difference when you go for the multi-thread
concept you use StringBuffer,Because it is thread safe ,that
means, if one thread access this stringbuffer variable on
the time another thread cant access this stringbuffer,so
stringbuffer is slowest performance compare to stringbuilder.

by raju.j

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why use string handling in Java?

809


What do you mean by default constructor in java?

824


Can we declare a class as static?

812


What does ide stand for?

716


Using callable statement how can you pass out parameters, explain with example?

901


Can we declare a static variable inside a method?

760


Can a class have multiple superclasses?

800


Write a program to search a number in the given list of numbers.

845


What is binary search in java?

797


What is array length?

728


What are operators and its types?

828


what is the difference between thread and runnable types? : Java thread

783


What is an example of character?

804


What is javac in java?

771


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

767