Hi,
Object type Comparision
String -->> immutable (Value once assigned cannot be modified)
StringBuffer -->> mutable (Value can be modified).
Performance comparision
Performance wise StringBuffer is better when u compare String with StringBuffer in string manipulation that is
ex:
String str = "Hello";
str = str+"World" ;
sop(str);
StringBuffer sbstr = new StringBuffer("Hello");
sbstr.append("world");
sop(sbstr.toString());
if we look at the above example the major and hidden difference is internally how JVM handles the string manipulation....
when we say str = str+"World";
internally ::
StringBuffer xxx = new StringBuffer(str);
xxx.append("World");
str = xxx.toString();
Now u can make out that internally there is a overhead of converting the String str to StringBuffer and applying append method on that and finally it is assigned backto the str the modifed str....
Cheers
satish