What is mutable and immutable in Strings?

Showing Answers 1 - 4 of 4 Answers

sunil belurgikar

  • Sep 29th, 2005
 

Mutable string means we can append to that string.example StringBuffer object is mutable string.String is immutable object

when we declre String="abc"; a string object abc with fixed length is created.We cant add anything to it .If we do java simply creates a new object.

Sarje

  • Aug 19th, 2009
 

immutabe string means once string is created you can not insert or append or remove any character from the string. Since java.lang.String class is immutable thess operations are not allowed in it.
mutable string means you can insert,append or delete any character from it.
Since java.lang.StringBuilder is mutable so insertion or deletion or appening character is possible here.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions