As far as I know eclipse doesnt support 5.0 syntax yet - even though
somet of the docs I've read say they do. I have had the whole thing
crash trying to use the template syntax. Supposedly 3.1 is supposed ot
fix that. Are you using 3.1?
On Tue, 21 Dec 2004 11:56:47 -0500, Critter <[EMAIL PROTECTED]> wrote:
> yeah... i got the greeting thing...
>
> according to the book i have...
>
> for(String g : greeting)
> is a new JDK 5.0 feature ....
>
> rather than the traditional for(i=0...etc..)
>
>
> On Tue, 21 Dec 2004 08:40:07 -0800, Spike <[EMAIL PROTECTED]> wrote:
> > You have a couple of problems with the syntax of your code:
> >
> > 1. You need to declare the greeting array as an array of strings before
> > using it:
> >
> > String[] greeting = new String[2]
> >
> > 2. The syntax of your for loop is invalid. I'd do it like this:
> >
> >
> > for (int i=0;i<greeting.length ; i++) {
> > System.out.println(greeting[i]);
> > }
> >
> > So the whole thing would be:
> >
> > *****************************
> >
> > public class Welcome {
> >
> > public static void main(String[] args) {
> > String[] greeting = new String[2]
> > greeting[0] = "Welcome";
> > greeting[1] = "howdy";
> >
> > for (int i=0;i<greeting.length ; i++)
> > System.out.println(greeting[i]);
> > }
> > }
> > ****************************
> >
> > Spike
> >
> > Critter wrote:
> > > I am just trying to build a simple class file using eclipse.. but I
> > > keep getting syntax errors..
> > >
> > > public class Welcome {
> > >
> > > public static void main(String[] args) {
> > > greeting[0] = "Welcome";
> > > greeting[1] = "howdy";
> > >
> > > for (String g : greeting)
> > > System.out.println(g);
> > > }
> > > }
> > >
> > > Severity Description Resource In Folder Location
> > > Creation Time
> > > 2 Syntax error on token ")", invalid
> > > AssignmentOperator Welcome.java Welcome line 20 December 21, 2004
> > > 10:51:12 AM
> > > 2 Syntax error on token(s), misplaced
> > > construct(s) Welcome.java Welcome line 20 December 21, 2004 10:51:12
> > > AM
> > >
> > > i am thinking it has to do with maybe eclipse using the wrong jre...
> > > but i am not sure.. I've pointed eclipse to use the newer jdk.. (i
> > > think..) any suggestions?
> >
> > --
> >
> > --------------------------------------------
> > Stephen Milligan
> > Code poet for hire
> > http://www.spike.org.uk
> >
> > Do you cfeclipse? http://cfeclipse.tigris.org
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188411
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54