Immutable means not changeable. when a string is declared and initiated with some values. Afterwards whenever we will concat that string or change that string. if we r going to add more characters in that string object. it will not allow dynamic size change. to cater such problem when any change will occur in string object the object will be recreated and previous object will be destroyed and new will be created with new size to accomodate change. thats y strings are immutable in java. Mutable Objects: When you have a reference to an instance of an object, the contents of that instance can be altered Immutable Objects: When you have a reference to an instance of an object, the contents of that instance cannot be altered |
Wednesday, November 11, 2009
what is the use of immutable String class in java?...
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment