Article View: borland.public.jbuilder.java.language
Article #19693Re: String Array.... Help Please...
From: Iceberg
Date: Thu, 01 Jan 1998 00:00
Date: Thu, 01 Jan 1998 00:00
46 lines
1876 bytes
1876 bytes
Amen! I had the same problem about 3 months ago...
In article <681u1b$mh33@forums.borland.com>, bobe@tiac.net says...
>
>Try something like this. Of course you need to read in your strings and fill
>in the array but the essential item is that
>Java does not allocate variables unless you create it with a "new" except
>for primitive types like "int".
>
>class StringArray {
> String Temp; // Variable that gets the string read in from
> String BBLabels[]; // Place holder for an array of Strings - does not
>allocate an array.
> void Initialize() {
> BBLabels = new String[100]; // Now allocate the array
> int Counter = 0;
> BBLabels[Counter] = Temp;
> Counter++;
> }
>}
>
>Bob Edison
>
>
>Troy DesBarres wrote in message <34A3DC17.F85BD328@whitehouse.acl.ca>...
>>I am trying to create a String Array of labels that after I have read
>>from the file I can
>>pass it through to SetLabels method of my Status bar.
>>
>>I have it setup like this.
>>String Temp; // Variable that gets the string read in from
>>the file.
>>String BBLables[]; // This should create an Array I thought.
>>int Counter = 0; // Go through the Array.
>>
>>// Then I just say:
>>BBLabels[Counter] = Temp;
>>Counter++;
>>
>>and this does not work....
>>What am I doing wrong?
>>
>>
>
>
Technical Details
Message-ID:
<68f93k$gdl$1@news3.texas.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34A3DC17.F85BD328@whitehouse.acl.ca> <681u1b$mh33@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,2583ba01705f56ce X-Google-Attributes: gidf74b3,public From: ckf@texas.net (Iceberg) Subject: Re: String Array.... Help Please... Date: 1998/01/01 Message-ID: <68f93k$gdl$1@news3.texas.net> X-Deja-AN: 311822533 References: <34A3DC17.F85BD328@whitehouse.acl.ca> <681u1b$mh33@forums.borland.com> Content-Type: Text/Plain; charset=US-ASCII Organization: Your Organization Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language