Monday, 7 July 2014

insert (int dstOffset, CharSequence s)

public StringBuffer insert(int dstOffset, CharSequence s)
Inserts the specified CharSequence into this sequence. The result of this method is exactly the same as if it were an invocation of this object's insert(dstOffset, s, 0, s.length()) method.

public class StringBufferInsertCharSequence {
    public static void main(String args[]){
        CharSequence s = "Hello, ";
        StringBuffer str = new StringBuffer("How are You");
        str.insert(0,s);
        System.out.println("str = " + str);
    }
}

Output
str = Hello, How are You



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment