Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Difference String and String Buffer

Answer Posted / gangabusi

String is immutable, we can not modify the string objects.
if we can create any string object
Ex: String S="Ganga";
here 'S' is string object created in heap memory.

I Want to add Something to S,
String S="Gangadhar";

Here In heap momory one more object is created for 'S',not
overridden.So that each and every updation String create
one new object in heap.



StringBuffer sb="Ganga"

here 'sb' is stringbuffer object created in heap memory.

I Want to add Something to sb,
StringBuffer sb="Gangadhar";

Here In heap momory 'sb' is overridden.So that each and
every updation StringBuffer create an object in stack.


It is mutable and it is Synchronized.(one thread process at
a time)

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is math an abstract class in java?

962


What is java used for?

979


Why do we create public static method in java?

1053


What is difference between checked and unchecked exception in java?

967


what is nested class in java?

1112


What is sortedset in java?

982


What is difference between an object and a class?

1081


What does bitwise or mean?

1039


What is private static in java?

1005


What are the basics of core java?

974


Which is better stringbuffer or stringbuilder?

879


Explain covariant method overriding in java.

1063


Can a constructor be made final?

1061


What is methodological framework?

982


Why does java not support pointers?

1024