[java programming] Re: String vs StringBuffer

2009-08-13 Thread Héctor Fabián Echeverry Quintero
: [java programming] Re: String vs StringBuffer I remeber there are three classes for String,String,StringBuffer,StringBuilder. String is a final class, can't change its address and its size.When we concat two string, There will create 3 strings. StringBuffer is also a final clas

[java programming] Re: String vs StringBuffer

2009-08-12 Thread Xianning Liu
I remeber there are three classes for String,String,StringBuffer,StringBuilder. String is a final class, can't change its address and its size.When we concat two string, There will create 3 strings. StringBuffer is also a final class,But its size is not static,So we can insert or append substring

[java programming] Re: String vs StringBuffer

2009-08-12 Thread miga
On Aug 12, 11:26 am, hefaeche wrote: > How can I see this? Thanks If you use Netbeans 6.7.1 (it should be more or less the same for other versions of Netbeans): 1 - put a break mark before the lines String str = ... and str.concat... 2 - in Preferences Java Debugger, make it so that only Do not

[java programming] Re: String vs StringBuffer

2009-08-12 Thread hefaeche
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 wrote: > How can I see this? Thanks > > On 11 ago, 19:07, Márcio Souza wrote: > > > With String => You'll creat

[java programming] Re: String vs StringBuffer

2009-08-12 Thread hefaeche
StringBuffer it's final class too On 11 ago, 17:53, "maa...@gmail.com" wrote: > I always thought String was a final class, while StringBuffer wasn't. > > Cheers, > > -m > > > > On Tue, Aug 11, 2009 at 5:37 AM, hefaeche wrote: > > > What it's the difference? Which it's better? > > > String str =

[java programming] Re: String vs StringBuffer

2009-08-12 Thread hefaeche
In my example, ¿str not it's mutable? On 11 ago, 20:11, Anand wrote: >  String is immutable . So whatever data stored in String var remain for > temporary whereas > StringBuffer stores data permanently.  so Stringbuffer is better > > 2009/8/11 Márcio Souza > > > > > With String => You'll create

[java programming] Re: String vs StringBuffer

2009-08-12 Thread hefaeche
How can I see this? Thanks On 11 ago, 19:07, Márcio Souza wrote: > With String => You'll create 3 Strings. > With StringBuilder => You'll create 1 String. > > vlw! > You > > 2009/8/11 maa...@gmail.com > > > I always thought String was a final class, while StringBuffer wasn't. > > > Cheers, > >

[java programming] Re: String vs StringBuffer

2009-08-11 Thread Anand
String is immutable . So whatever data stored in String var remain for temporary whereas StringBuffer stores data permanently. so Stringbuffer is better 2009/8/11 Márcio Souza > With String => You'll create 3 Strings. > With StringBuilder => You'll create 1 String. > > vlw! > You > > 2009/8/11

[java programming] Re: String vs StringBuffer

2009-08-11 Thread Márcio Souza
With String => You'll create 3 Strings. With StringBuilder => You'll create 1 String. vlw! You 2009/8/11 maa...@gmail.com > I always thought String was a final class, while StringBuffer wasn't. > > Cheers, > > -m > > On Tue, Aug 11, 2009 at 5:37 AM, hefaeche wrote: > >> >> What it's the differ

[java programming] Re: String vs StringBuffer

2009-08-11 Thread maa...@gmail.com
I always thought String was a final class, while StringBuffer wasn't. Cheers, -m On Tue, Aug 11, 2009 at 5:37 AM, hefaeche wrote: > > What it's the difference? Which it's better? > > String str = new String( "Hola" ); > str = str.concat(" Mundo" ); > System.out.println( str ); > > vs > > Strin