Basic example using String Buffer Class in Java

Here is the simple program for printing basic example using string buffer in Java.

Source Code

import java.util.Scanner;
class str
  public static void main(String args[])
   int i,n;
   // str="Tutor Joes";
   StringBuffer str =new StringBuffer("Tutor Joes");
   System.out.print("\nOriginal Message : "+str);
   System.out.print("\nLength : "+n+"\n");
     System.out.print("   "+str.charAt(i));
   String a=new String(str.toString());
   int pos = a.indexOf(" ");
   System.out.print("\nLocation : "+pos);
   str.insert(pos," Computer");
   System.out.print("\nModify Message : "+str);
   System.out.print("\nModify Message : "+str);
   str.append(" Very Good");
   System.out.print("\nModify Message : "+str);
To download raw file Click Here


Original Message : Tutor Joes
Length : 10
   T   u   t   o   r       J   o   e   s
Location : 5
Modify Message : Tutor Computer Joes
Modify Message : Tutor *omputer Joes
Modify Message : Tutor *omputer Joes Very Good

Learn All in Tamil © Designed & Developed By Tutor Joes