Difference between String & StringBuffer

Answer Posted / srikanth reddy

-->String objects are constants and immutable where as
StringBuffer objects are mutable
-----------------------------------------
-->in string class we can create object by two ways
1)using new operator --> string s = new String("Java");

2)without new operator --> String s2="raju";

------------------------------------------
-->in string class there string constant pooling technique
but in stringbuffer there is no facility
-------------------------------------------
all the methods in stringbuufer class is synchorined so
thread safe but not in string class

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many ways can an argument be passed to a subroutine and explain them?

582


What does int argc char * argv [] mean?

519


What is constant in programming?

560


What is difference between string and new string?

543


Can string be considered as a keyword?

574






What is the difference between conversation & casting?

582


why using interface interface ?

1514


What are the advantages of autoboxing?

539


What is a boolean in java?

580


What is package protected in java?

528


Define class?

518


Why is string builder not thread safe?

594


What is boolean query?

536


Is nullpointerexception checked or unchecked?

559


What is the difference between JDK and JVM?

635