Tuesday 8 July 2014

insert (int offset, long l)

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

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

Output
Value of longVal is 10


1. Throws StringIndexOutOfBoundsException, if the offset is invalid.


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment