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

Can finally block be used without a catch?

1057


What is static block?

1182


What are some examples of variable costs?

1005


Which number is denoted by leading zero in java?

1301


Why does java not allow multiple public classes in a java file ?

4648


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

1037


Why do we use string?

1115


Explain creating threads by extending thread class ?

1089


Tell me the latest versions in java related areas?

1134


What is contractor means and methods?

1033


Is there a way to increase the size of an array after its declaration?

1086


What is a vararg?

1112


Why are getters and setters used?

1101


What is the importance of main method in Java?

1095


Can you use abstract and final both with a method?

1156