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 between String & StringBuffer

Answer Posted / nilesh bhil( mca) amravati

String is immutable.
It means that we cant change the content of String once created. If we try append a new string using + operator
then it creates new String object.
ex.
string s = new String("Java");
s = s + "bean" ;// this statement creates new object.
String class does not have method that append new String to old String in object.


where as StringBuffer class is mutable. It means that we can add new String to it using append() method.
ex.
StringBuffer sb = new StringBuffer("Java");
sb.append("Bean");

Is This Answer Correct ?    38 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between comparator and comparable in java?

937


What are the access modifiers in java?

1030


Can we serialize arraylist in java?

997


Can I uninstall java?

1041


What do you mean by composition in java?

1011


What happens if we override only equals?

968


Can inner class have constructor?

1037


What are the main uses of java?

984


when you will synchronize a piece of your code? : Java thread

1007


what is synchronization and why is it important? : Java thread

1077


What is number data type in java?

1004


How to store image in arraylist in java?

966


Why java is considered as platform independent?

997


I want to re-reach and use an object once it has been garbage collected. How it's possible?

1017


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

997