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

Write a program to check string is palindrome without using loop?

989


What are functions in java?

905


Can we have any code between try and finally blocks?

973


How many wrapper classes are there in java?

973


What is consumer in java?

927


What is the generic function?

937


What is starvation?

1229


Can substring create new object?

1066


How does multithreading take place on a computer with a single cpu?

957


What are the major drawbacks of external iteration?

1019


What is public/private protected in java?

1001


What is the java project architecture?

2195


Can a class have 2 constructors?

853


What are the restrictions imposed on method overriding?

969


How are the elements of a gridbaglayout organized?

1006