9:31 pm - Thursday July 19, 2018

StringBuilder Example Program for insert(int offset,long l)

CANDID INDUSTRIAL TRAINING -- CHENNAI
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 long value argument into this sequence Stringbuilder s1
*/
public class StringInsert5
{
public static void main(String ar[]) throws Exception
{
StringBuilder s1=new StringBuilder("MyLongValue:");
                                                       // object created for string builder with content ?MyLongValue:?
long l=999999999;
System.out.println("Before inserted:"+s1);
s1=s1.insert(11,l);       //string representation of long value argument after 11th location
System.out.println("After inserted:"+s1);
}
}

OUTPUT:

Before inserted: MyLongValue:
After inserted: MyLongValue: 999999999

BACK

Filed in: Z-A All Java Codes

Comments are closed.