Article View: borland.public.jbuilder.java.language
Article #8706Re: Declaring an Array of Strings?
From: Thomas682
Date: Thu, 08 Mar 2001 16:37
Date: Thu, 08 Mar 2001 16:37
34 lines
1686 bytes
1686 bytes
hi,
String AddressLine[];
for(int i=0;i<7;i++)
AddressLine[i]= new String("xxx");
no compile error but runtime exception-(Not exists)
hmmmmm - Malloc( ?????
Thanks for Help
Thomas
"Tor Iver Wilhelmsen" <tor.wilhelmsen@sds.no> wrote in message
news:uu254bq17.fsf@sds.no...
> "Harry Whitehouse" <harry@envmgr.com> writes:
>
> > String AddressLine[];
>
> Note that this only declares the reference, it does not assign an
> actual array to it.
>
> > for(int i=0;i<7;i++)
> > AddressLine[i]= new String; // line 208
>
> Unlike C++ and C#, constructors in Java need a parenthesis also when
> there are no arguments to the constructor. Also, String doesn't have a
> no-args constructor, so you need an argument.
Technical Details
Message-ID:
<3aa7a736_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!netnews.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!dnews!212.211.74.178References:
<3aa6df5f$1_2@dnews> <uu254bq17.fsf@sds.no>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 07:48:05 PST From: "Thomas682" <SchwendnerThomas@Compuserve.com> Newsgroups: borland.public.jbuilder.java.language References: <3aa6df5f$1_2@dnews> <uu254bq17.fsf@sds.no> Subject: Re: Declaring an Array of Strings? Date: Thu, 8 Mar 2001 16:37:12 -0000 Lines: 36 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: 212.211.74.178 Message-ID: <3aa7a736_2@dnews> X-Trace: 8 Mar 2001 07:37:26 -0800, 212.211.74.178 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!netnews.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!dnews!212.211.74.178