3.strings in Java-2
3.strings in Java-2
3.strings in Java-2
Constructor:
StringBuffer s1=new StringBuffer();
Demo Code:
Class stringbuf
{
public static void main(String args[])
{
StringBuffer t=new StringBuffer(“Have Java”);
System.out.println(“Origional String is”+t);
t.insert(4,”a cup of”);
t.setCharAt(5,’*’);
t.append(“its fantastic”);
System.out.println(“after modification”+t);
System.out.println(“reverse of string is”+t.reverse());
}
}