And you get a new string builder each loop. If you use string builder and
recycle it you don't have to re-create the object. Which doesn't create so
much garbage.
You have the answer and you don't understand it.



> Try compiling these two classes.  They produce *identical* class files:
>
> ---- File m1/Stringy.java ----
> public class Stringy {
>         public static void main(String[] args) {
>                 String foo = "def";
>                 System.out.println("abc" + foo);
>         }
> }
> ---- File m2/Stringy.java ----
> public class Stringy {
>         public static void main(String[] args) {
>                 String foo = "def";
>                 System.out.println(new
> StringBuilder().append("abc").append(foo).toString());
>         }
> }


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to