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

what is mutability?which one is mutable String or StringBuffer?and why?give
examples of each which shows the mutability of each String or StringBuffer

Answer Posted / arjunkumar

Mutability means data which we can change.
StringBuffer class is mutable, because it can change its
data where as String class cant.
Example:
If you want to combine two strings we have two methods i.e
append() method and concat() method.
here append() is used to append the 2nd string to 1st string
and it can store in memory. where as concat() method is
combine the 2nd string to 1st string but it is not actuly
stored in memory it just show to us as combind

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of using javap?

1028


What is a class instance variable?

1058


Can java list be null?

943


Why chararray() is preferred over string to store the password?

959


What flag up means?

983


What is the difference between instanceof and isinstance?

985


What is set string?

1080


What is an infinite loop?

1131


Can a static class have a constructor?

966


Which variables are stored in heap?

974


What are the basic interfaces of java collections framework?

1044


What is meant by design patterns?

977


Can you write a java class that could be used both as an applet as well as an application?

908


What is natural ordering in java?

899


What is the main functionality of the remote reference layer?

1943