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 / vinodkumar uttara student

StringBuilder all methods are not synchronized , nothing
changes done in this class , it is same as StringBuffer.I
mean to say , more than one thread can be execute
StringBuilder object , because there is not a concept of
lock on object , any thread can execute on this object.Where
as StringBuffer class all methods are synchronized only one
thread at time can access synchronized method , because it
get lock on object.

Please help me , if i am right?
is it correct,
thanks for the reply

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to find the given number is a prime number or not by getting input from the user

770


What is the basic of java?

784


How do you implement polymorphism in our day to day life?

2963


Difference between static binding and dynamic binding?

788


What is ascii code?

832


Is java free for commercial?

667


Can a final variable be null?

753


What are daemon Threads in java?

863


Why we used vector class?

820


What is boolean flag in java?

794


What is the difference between the ">>" and " >>>" operators in java?

731


What is the difference between hashset and treeset in java?

767


Difference between overriding and overloading in java?

823


What is the return type of the main method?

790


What is identifier give example?

785