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

What does .equals do in java?

527


What is field name?

585


Why put method is used?

522


How are destructors defined in java?

569


Difference between object and reference?

676






What are meta-annotations?

553


What is a map in java?

546


Does java trim remove newline?

538


How to read and write image from a file ?

553


What is finally block?

564


whatis Home interface and Remoteinterface? with example?

1546


What are the differences between graph and tree?

643


What are reference variables in java?

592


What are advantages of exception handling in java?

581


How many types of the indexof method are there for strings?

487