Monday 7 July 2014

insert (int offset, double d)

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

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

Output
Value of d is 10.05

1. Throws StringIndexOutOfBoundsException, if the offset is invalid.


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment