Article View: borland.public.jbuilder.java.language
Article #19754Re: String Array.... Help Please...
From: Robert Edison
Date: Fri, 26 Dec 1997 00:00
Date: Fri, 26 Dec 1997 00:00
40 lines
1659 bytes
1659 bytes
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:
<681u1b$mh33@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34A3DC17.F85BD328@whitehouse.acl.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,2583ba01705f56ce X-Google-Attributes: gidf74b3,public From: "Robert Edison" <bobe@tiac.net> Subject: Re: String Array.... Help Please... Date: 1997/12/26 Message-ID: <681u1b$mh33@forums.borland.com> X-Deja-AN: 310446128 References: <34A3DC17.F85BD328@whitehouse.acl.ca> X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Organization: None Newsgroups: borland.public.jbuilder.java.language