Article View: borland.public.jbuilder.java.language
Article #8703Re: Declaring an Array of Strings?
From: John McGrath TeamB
Date: Thu, 08 Mar 2001 10:37
Date: Thu, 08 Mar 2001 10:37
18 lines
1427 bytes
1427 bytes
On Wed, 07 Mar 2001 18:24:59 -0800, Marcel Gabi wrote:
> String mystring = new String(); creates a new string
> object which represents an empty string.
> You can also create an empty string like this:
> String mystring = "";
But the second form ( mystring = "" ) is much better. The first form
will create an extra String object, whereas the second form will not.
Since Strings are immutable, there is no reason to create duplicates.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.15111f18f99e6cb098a030@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.wirehub.nl!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mailReferences:
<3aa6df5f$1_2@dnews> <3AA6ED7B.121C3A5C@borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,9324d780b1c839d2 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-08 02:44:06 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.wirehub.nl!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Declaring an Array of Strings? Date: Thu, 8 Mar 2001 05:37:03 -0500 Organization: Another Netscape Collabra Server User Lines: 19 Message-ID: <MPG.15111f18f99e6cb098a030@forums.borland.com> References: <3aa6df5f$1_2@dnews> <3AA6ED7B.121C3A5C@borland.com> NNTP-Posting-Host: dslcv1-60.fast.net X-Newsreader: MicroPlanet Gravity v2.30