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

How we can declare a static variable?

650


Is double bigger than float?

545


Can we increase size of array?

568


How will you compute size of a structure?

584


List some important characteristics on jre

592






Difference between arraylist and hashset in java?

543


Differentiate between == and equals().

594


Which method must be implemented by all threads?

720


does java support pointers?

564


Explain how can you debug the Java code?

588


What is a file pointer?

514


Can classes declared using the abstract keyword cab be instantiated?

557


Explain about anonymous inner classes ?

578


What is callablestatement? How you can call stored procedure to pass in parameter?

542


How do you insert a line break?

496