Yeah, I agree.
-----Original Message-----
From: A mailing list for Java(tm) 2 Platform, Enterprise Edition
[mailto:J2EE-INTEREST@(protected)
Sent: Monday, October 24, 2005 10:13 AM
To: J2EE-INTEREST@(protected)
Subject: Re: Stringbuffer
I would put my penny on 6 in the first case and 4 in
the second. Inmutable objects creates a new string
with the + operator ?!?
--- Duc Vo <dvo@(protected):
> 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)
> 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)
> 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)
> message "help".
>
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
========================================================================
===
To unsubscribe, send email to listserv@(protected)
body
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".
===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".