Article View: borland.public.jbuilder.java.language
Article #17788Re: Array of Strings: How?
From: Paul Gifford
Date: Thu, 01 Oct 1998 00:00
Date: Thu, 01 Oct 1998 00:00
45 lines
1726 bytes
1726 bytes
You are correct. Strangely enough, we couldn't get it to compile on
another machine using Cafe either. I came back, looked at it, and
realized what was causing the error.
I had the code located at the top of the class. I left the
declaration there, moved the 2nd line of code into Start, and it
worked fine.
Still don't know why it gave Cafe a fit, since we tested the code
inside a function...oh well, that's on someone else's machine. Mine
works fine :)
p
On Thu, 01 Oct 1998 19:04:45 GMT, hillca@cs.purdue.edu (Chris Hill)
wrote:
>Your code looks file and compiles for me. Perhaps there is a problem
>with the other code in the file?
>
>On Thu, 01 Oct 1998 16:07:30 GMT,
>paul.gifford@ibm.take.me.outta.here.net (Paul Gifford) wrote:
>
>>
>>
>> I want an array of strings. Here's sample code:
>>
>> String names[] = new String[10];
>> names[0] = new String("Bob Smith");
>>
>> Which is apparently the correct syntax according to "Java By
>>Example" (from Sun). However, I get error "(37) ']' expected, with
>>the cursor positioned after "names[" on the 2nd line.
>>
>> What's my mistake?
>>
>>TIA
>>
>>p
>>
>
>Chris Hill
>hillca@cs.purdue.edu
Technical Details
Message-ID:
<3613fb6e.6057675@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3613a7dc.5144351@forums.inprise.com> <3613d088.131866343@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,4bb9832368efc845 X-Google-Attributes: gidf74b3,public From: paul.gifford@ibm.take.me.outta.here.net (Paul Gifford) Subject: Re: Array of Strings: How? Date: 1998/10/01 Message-ID: <3613fb6e.6057675@forums.inprise.com> X-Deja-AN: 396836393 References: <3613a7dc.5144351@forums.inprise.com> <3613d088.131866343@forums.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language