Stringbuffer 2005-10-23 - By Duc Vo
Back If I don't misunderstand your question, there are 4 in method 1 and also 4 in method 2.
-- --Original Message-- -- From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)] On Behalf Of SUBSCRIBE EJB-INTEREST anonymous Sent: Monday, October 24, 2005 9:39 AM To: J2EE-INTEREST@(protected) Subject: Stringbuffer
Hi, Could anyone please mail be which one would be better of the below two in performance. How many strings will be created in Method1 and how many in Method2? Thanks in advance.
Method - 1
String b = "beta"; StringBuffer buf = new StringBuffer("The strings are "); buf.append("a"+ b + "c");
Method - 2 String b = "beta"; StringBuffer buf = new StringBuffer("The strings are "); buf.append("a").append(b).append("c");
=========================================================================To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
==========================================================================To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
|
|