8:34 pm - Tuesday April 23, 2019

StringBuilder Example Program for insert(int offset,double d)

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
*@author :CandidJava.com
*@descriptions : This program explains the function and use of method insert (int offset, double d) to insert the string representation of the double argument into this sequence Stringbuilder s1
public class StringInsert2
public static void main(String ar[]) throws Exception
StringBuilder s1=new StringBuilder("Obtained: DoubleValue");
                                   // object created for string builder with content ?Obtained: DoubleValue?
double d=0.007;
System.out.println("Before inserted:"+s1);
s1=s1.insert(9,d); //string representation of double argument after 9th location
System.out.println("After inserted:"+s1);


Before inserted: Obtained: DoubleValue
After inserted: Obtained: 0.0070 DoubleValue


Filed in: Z-A All Java Codes

Comments are closed.