Article View: borland.public.jbuilder.java.language
Article #18895Re: Trouble with string arrays
From: Regis Eloi
Date: Fri, 03 Apr 1998 00:00
Date: Fri, 03 Apr 1998 00:00
32 lines
1732 bytes
1732 bytes
Jacques Chaurette wrote:
> Hi folks,
> I've declared a string array in the beginning of my program with
> String[] sData;
> when I try to input values into this array in a later portion with
If you choose to declare the array by String sData[]; the only way to set
values is bysData = new String[n];
sData[i] = vali;
The other way is String sData[] = {"...","mmm"};
May be the Vector class would be more appropriate?
> sData = {"...", "mmm"};
> I get an error that says illegal start of expression?
> What's wrong?
> I can fix it by changing the line to:
> String[] sData = {"...", "mmm"};
> but then it doesn't recognize the initial declaration. This is a problem
> because I also need to initialize the initial sData declaration value.
Hope that helps.
Regis
--
________________________________________________________________________
Regis Eloi mailto:R.Eloi@dcs.hull.ac.uk
The University of Hull (England) - Department of Computer Science
Institut d'Informatique d'Entreprise (France)
My CV is on the Web at http://www-eleves.iie.cnam.fr/eloi/cv_en.html
________________________________________________________________________
Technical Details
Message-ID:
<3524D2D3.D0A1BDC6@dcs.hull.ac.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6g1np8$bgt1@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,adedeeaeecd4c042 X-Google-Attributes: gidf74b3,public From: Regis Eloi <R.Eloi@dcs.hull.ac.uk> Subject: Re: Trouble with string arrays Date: 1998/04/03 Message-ID: <3524D2D3.D0A1BDC6@dcs.hull.ac.uk> X-Deja-AN: 340491275 Content-Transfer-Encoding: 7bit References: <6g1np8$bgt1@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: University of Hull Mime-Version: 1.0 Reply-To: R.Eloi@dcs.hull.ac.uk Newsgroups: borland.public.jbuilder.java.language