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 and StringBuffer.

Answer Posted / geetha

String and StringBuilder class stores strings. But when you
cannot change a String object after creating one.
eg: String name = "Prasad";
By saying you cannot change the name object means you cannot
change the value in name object internally. When you change
the name object value to something else, a new String object
is creating in memory and assign the new value.

eg: name = "Prasad Reddy";

A new name object is creating in memory and the value
"Prasad Reddy" is assinging to the newly created space.

But StringBuilder class occupies the same space even if you
change the value.

If you are doing string concatenation StringBuilder class is
far better in performance than String class.

You can use StringBuilder's Append() method to use
concatenation.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is struts in java?

987


What is use of static in java?

1087


What is number data type?

969


What are some characteristics of interference class?

945


What is a parameter in java?

951


Can we override the overloaded method?

1054


Can inner class extend any class?

1008


What is difference between an object and a class?

1070


What is the java virtual machine?

1015


What are different types of control structures?

917


What happens to the Exception object after handling an exception?

2323


What is the method to expand and collapse nodes in a jtree?

982


How finally used under exception handling?

896


What is the significance of listiterator?

1020


Explain about abstract classes in java?

984