While String is a immutable class in java whose contents can't be changed ,String buffer is a writable character sequence as we can keep adding more characters to the same String buffer object.
Like in example below we created a String buffer object Hello and then we can append more characters to it.
StringBuffer sb=new StringBuffer("Hello ");
sb.append("World");//now original string is changed to Hello World
sb.insert(5,"My");//now original string is changed to HelloMyWorld
sb.replace(0,4,"Welcome"); ;//now original string is changed to WelcomeMyWorld