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 into other string,which only create 1
Object.Another thing , this class is synchronization security. So it will
cost some time to create a object.

StringBuilder has all function of StringBuffer. But it's not synchronization
security. So it cost  less time when create object.


2009/8/12 miga <[email protected]>

>
>
>
> On Aug 12, 11:26 am, hefaeche <[email protected]> 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 step
> into synthetic methods be checked and none of java.lang.String... be
> checked.
> 3 - Debug your application stepping into at each step
> You will see the construction of the strings, to get the value expand
> string and see into value in the debugger output window
>
> Thereafter, change again the Java debugger preferences to not be
> annoyed with all the static initializers and constructors.
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to