If a string is immutable, does that mean that.... (let\'s assume JavaScript)
var str = \'foo\';
alert(str.substr(1)); // oo
alert(str); // foo
Immutable means the value can not be changed. Once created a string object can not be modified as its immutable. If you request a substring of a string a new String with the requested part is created.
Using StringBuffer while manipulating Strings instead makes the operation more efficient as StringBuffer stores the string in a character array with variables to hold the capacity of the character array and the length of the array(String in a char array form)