Tuesday, 8 July 2014

insert (int offset, String str)

public synchronized StringBuffer insert(int offset, String str)
Inserts the string str into this sequence at the indicated offset.

public class StringBufferInsertString {
    public static void main(String args[]){
       String str = new String("wxyz");
       StringBuffer s = new StringBuffer("Value of str is ");
       s.insert(s.length(), str);
       System.out.println(s);
    }    
}

Output
Value of str is wxyz



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment