public
StringBuffer insert(int offset, int i)
Inserts
the string representation of the second int argument into this
sequence at the indicated offset.
public class StringBufferInsertInt { public static void main(String args[]){ int i = 11; StringBuffer str = new StringBuffer("Value of i is "); str.insert(str.length(), i); System.out.println(str); } }
Output
Value of i is 11
1. Throws
StringIndexOutOfBoundsException, if the offset is invalid.
No comments:
Post a Comment