wood burning stoves*
The moose likes Beginning Java and the fly likes Enhanced loops and ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enhanced loops and ArrayList" Watch "Enhanced loops and ArrayList" New topic
Author

Enhanced loops and ArrayList

Joseph Sheridan
Greenhorn

Joined: Jun 11, 2005
Posts: 5
Hello,

I'm currently trying to learn Java using the excellent book 'Head first Java' but I cannot get 'enhanced loops' or 'ArrayLists' to work - the compiler gives syntax errors. Has anybody an idea what might be wrong.

Thanks,

Joe
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What compiler are you using? EFL and Generics are part of Java 1.5. (Sometimes called Java 5 or Tiger).


GenRocket - Experts at Building Test Data
Joseph Sheridan
Greenhorn

Joined: Jun 11, 2005
Posts: 5
Hi Gregg,

many thanks for your prompt reply ! I have since discovered that the problem has nothing to do with 'Java' but with the fact that I am using Eclipse which as standard only supports Java up to 1.4. I have tried unsuccessfully to install the 'Cheetah' plugin - get the error that the org.eclipse.jdt (3.0.0) is required - as far as I can see it is installed.

Thanks again for your help,

Joe
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Joseph Sheridan:
Hi Gregg,

many thanks for your prompt reply ! I have since discovered that the problem has nothing to do with 'Java' but with the fact that I am using Eclipse which as standard only supports Java up to 1.4. I have tried unsuccessfully to install the 'Cheetah' plugin - get the error that the org.eclipse.jdt (3.0.0) is required - as far as I can see it is installed.

Thanks again for your help,

Joe


I thought of that too but since you said "compile" I figured you might not be using an IDE and better check the compiler version instead. If you download the Eclipse 3.1RC it supports the 1.5 language enhancements.

Also, I think that you can turn off automatic compiling in Eclipse and even though the editor will not support the syntax, it will still compile it just fine. But I'd just download 3.1.
Joseph Sheridan
Greenhorn

Joined: Jun 11, 2005
Posts: 5
Hi Gregg,

thanks yet again ! Did as you suggested - downloaded 3.1. Now I just have to figure out how you get all my classes from the workspace in 3.0 to the new Version.

Joe
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Now I just have to figure out how you get all my classes from the workspace in 3.0 to the new Version.
just a guess:
when opening up, eclipse prompts you to chose an workspace: just point to your previous one, or instead create a new one and copy the older to this new folder


java amateur
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enhanced loops and ArrayList
 
Similar Threads
For Each LOOP Question
Which Java version?
Discussing errata for K&B, SCJP 6
Enhanced for loops
about Enhanced For loop