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

why String class is immutable.

Answer Posted / rakesh soni

Any Program have 'Performance' and 'Memory' issue.
1. If you want to save your 'memory' then use the 'String'
class but 'Performance' will be decrease, because every time
new object create and old object memory collect by Garbage
Collector, so performance decrease.
And
2. If you want 'Performance', than use 'StringBuffer' or
'StringBuilder' object. These class's object consume more
memory but not create new object, so 'Performance' will
increase but with memory overhead.

So take decision according your code and issue. :)

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if a constructor is declared private?

1036


Can a constructor have different name than a class name in java?

1194


when to use ArrayList and when to use HashMap in webApplication.

4707


What are desktop procedures?

1043


what is interface in java? Explain

968


What modifiers may be used with a top-level class?

1064


What is the purpose of the return statement?

1058


What is java instanceof operator?

1043


Explain a few methods of overloading best practices in java?

987


What is singleton math?

1130


What is assembly condition codes?

990


What is <> used for in java?

1115


What is return null in java?

964


What access modifiers can be used for variables?

1148


what is the difference between future and callable interface in java?

1234