🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17789

Re: Array of Strings: How?

#17789
From: Chris Hill
Date: Thu, 01 Oct 1998 00:00
59 lines
2263 bytes
Inside a function the code is valid (a declaration with an
initialization expression and a statement).  At the class level, the
2nd line is not valid because statements aren't allowed in that scope.

I don't understand what you mean about giving Cafe a fit, but that's
OK, just tell your coworker to use JBuilder as a fix. :)

On Thu, 01 Oct 1998 22:02:20 GMT,
paul.gifford@ibm.take.me.outta.here.net (Paul Gifford) wrote:

>
>
>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
>

Chris Hill
hillca@cs.purdue.edu
Technical Details
Message-ID: <3613fec2.143700550@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3613a7dc.5144351@forums.inprise.com> <3613d088.131866343@forums.borland.com> <3613fb6e.6057675@forums.inprise.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: hillca@cs.purdue.edu (Chris Hill)
Subject: Re: Array of Strings:  How?
Date: 1998/10/01
Message-ID: <3613fec2.143700550@forums.borland.com>
X-Deja-AN: 396841564
References: <3613a7dc.5144351@forums.inprise.com> <3613d088.131866343@forums.borland.com> <3613fb6e.6057675@forums.inprise.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language