hi to all. well can you please tell me that why String class
is immutable?

Thanks in advance.

Answer Posted / hari

Well it is immutable because of the memory concern. For
every new string if there is new object then it will take
lot of memory and if there is such requirement then there
is StringBuffer class provided.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the constructor and how many types of constructors are used in java?

541


Why map is used in java?

586


Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

547


Why do we need autoboxing in java?

527


Who found java?

560






What do you understand by soft reference?

589


Explain about the performance aspects of core java?

561


Differentiate storage classes on the basis of their scope?

680


Why is logger singleton?

568


What is jdbc api?

544


What are the benefits of operations in java?

499


How do you do exponents in java?

549


What is the platform?

540


What is super keyword explain with example?

541


How to compare two strings in java program?

678