🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7751

Re: Different between String("") and String()

#7751
From: Mark Griffiths
Date: Tue, 22 May 2001 18:45
20 lines
1344 bytes
"Rozita Hedayaty" <rhedayaty@DataManagementCorp.com> wrote in message
news:3b0aacf1_2@dnews...
> Is there any different between these two statement? Do both create an
empty
> string?
>
> String x = new String();
> String y = new String("");
>

Yes, both create an empty string.  I took a quick look at the source code
for java.lang.String, and I think it is fair to say that the first form is
marginally more efficient.

> Thanks,
>
> RH
>
>
>
Technical Details
Message-ID: <3b0ab393$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b0aacf1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,a9ac66d2eb8cf715
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-22 11:46:04 PST
From: "Mark Griffiths" <remove.this.mark@chive.com>
Newsgroups: borland.public.jbuilder.java.language
References: <3b0aacf1_2@dnews>
Subject: Re: Different between String("") and String()
Date: Tue, 22 May 2001 19:45:07 +0100
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 213.122.197.62
Message-ID: <3b0ab393$1_1@dnews>
X-Trace: dnews 990557075 213.122.197.62 (22 May 2001 11:44:35 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews