Monday, 7 July 2014

insert (int offset, char c)

public synchronized StringBuffer insert(int offset, char c)
Inserts the string representation of the char argument into this sequence at the indicated offset.

public class StringBufferInsert {
    public static void main(String args[]){
        StringBuffer str = new StringBuffer("String str is ");
        str.insert(str.length(), 'a');
        System.out.println(str);
    }
}

Output
String str is a


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment