P
printdude1968
I read in a book that String objects are immutable, yet a few lines
later they show some code in which a String object is added to by
using the '+' operation. I must be misunderstanding what is meant by
immutable becuase it seems to me that
String s = 'hello';
s += 'good-bye';
should result in a compiler error if in fact the string is
immuatable. Can anyone clarify this for me?
later they show some code in which a String object is added to by
using the '+' operation. I must be misunderstanding what is meant by
immutable becuase it seems to me that
String s = 'hello';
s += 'good-bye';
should result in a compiler error if in fact the string is
immuatable. Can anyone clarify this for me?