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

Is there any sort function in java?

571


what is the significance of listiterator in java?

611


Explain the reason behind ending a program with a system.exit(0)?

592


Where is core java used?

570


Is oracle java 11 free?

520






What are the methods of object class ?

557


What is string subsequence method?

621


Can we make a constructor final?

534


When will you define a method as static?

547


Give me an example of array and linked list? Where they can be used?

548


Write a java program for binary search?

601


How to declare objects of a class ?

581


Write the algorithm to check the number non-leaf nodes in a tree.

582


What is the difference between serializable and externalizable interface?

563


Why are variables important in research?

548