Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enhanced loops and ArrayList

 
Joseph Sheridan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What compiler are you using? EFL and Generics are part of Java 1.5. (Sometimes called Java 5 or Tiger).
 
Joseph Sheridan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic