Monday 7 July 2014

insert (int offset, float f)

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

public class StringBufferInsertFloat {
    public static void main(String args[]){
       float f = 10.05f;
       StringBuffer str = new StringBuffer("Value of f is ");
       str.insert(str.length(), f);
       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