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?

1002


What are the Main functions of Java?

1082


What is class array in java?

1037


How to convert string to char and vice versa?

991


What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?

1035


Why constructor has no return type?

1099


Java.util.regex consists of which classes?

989


How many types of threads are there in java?

1050


Mention some features of java?

949


What is re-factoring in software?

1046


How does regex work?

951


Can you instantiate the math class in Java?

1081


Explain the concept of hashtables?

1124


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

1082


Explain runtime exceptions?

1166