Perhaps the question should be: What does it mean that String is not mutable? On the other hand, if StringBuffer is better, why not always use StringBuffer?
On 12 ago, 11:26, hefaeche <[email protected]> wrote: > How can I see this? Thanks > > On 11 ago, 19:07, Márcio Souza <[email protected]> wrote: > > > With String => You'll create 3 Strings. > > With StringBuilder => You'll create 1 String. > > > vlw! > > You > > > 2009/8/11 [email protected] <[email protected]> > > > > I always thought String was a final class, while StringBuffer wasn't. > > > > Cheers, > > > > -m > > > > On Tue, Aug 11, 2009 at 5:37 AM, hefaeche <[email protected]> wrote: > > > >> What it's the difference? Which it's better? > > > >> String str = new String( "Hola" ); > > >> str = str.concat(" Mundo" ); > > >> System.out.println( str ); > > > >> vs > > > >> StringBuffered str=new StringBuffered("Hola") > > >> str.append( " Mundo" ); > > >> System.out.println( str ); > > > >> (jdk 1.6) > > > > -- > > > I've never met anyone who liked George W. Bush. > > > > -Some guy from Denmark I met in Iceland > > --~--~---------~--~----~------------~-------~--~----~ 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/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
