Hello everybody, It's amazing to see the help regarding this topic "Difference between String and StringBuffer", Every topic says that String is immutable where as StringBuffer is mutable. But please can any one be more elaborative on this topic. I mean what exactly we can do with StringBufer and we can't with String. A practical explanation will be the best answer to this question. or else a step by step differences. from 1 to say .... will also do.
Hey, that's the difference...... really when we create a string say String a="abc"; & then perform the operation a=a+"xyz"; now "abc" string wud still exist in the pool it won't be modified in addition there wud be a new string created "abcxyz" and get assigned to a. so in all there wud be two strings in the pool "abc" & "abcxyz"
but when we use StringBuffer then the original string can be modified instead of second string getting created evrytime. I hope it wud help. [ August 23, 2006: Message edited by: Ela Jha ]