package stringbuffer;
import java.util.Scanner;
public class Sb {
public static void main(String[] args) {
Scanner s =new Scanner(System.in);
System.out.println("enter the string");
String s1=s.nextLine();
StringBuffer sb=new StringBuffer(s1);
//append
System.out.println("enter the string to append");
String s2=s.nextLine();
System.out.println(sb.append(s2));
//insert
System.out.println("enter the string to insert");
String s3=s.nextLine();
System.out.println(sb.insert(4,s3));
//Replace
System.out.println("enter the string to replace");
String s4=s.nextLine();
sb.replace(5,8,s4);
//delete
System.out.println(sb.delete(1,3));
//reverse
System.out.println(sb.reverse());
//capacity
System.out.println(sb.capacity());//(16/2)+2=34
//ensurecapacity
sb.ensureCapacity(10);//34+10=44
}
}