I read that String is fixed length character sequence,whereas StringBuffer is varied length character sequence!
Well, rather than saying "fixed length", we say immutable. Which means that once you've set its value, you cannot change it anymore.
String mystring = "a";
mystring = mystring + "b";
You think that you are using the same String variable, but in fact, JVM create a new one. You'll usually use StringBuffer to concatenate Strings. This avoids creating of new strings each time.