This code compiles and runs fine for me (once I add a line int z = 2;).
Your compiler "knows" about enum, but apparently isn't using it. So my guess is that you're using an IDE (like Eclipse) that is set to compile at a version lower than 1.5.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Jun 15, 2007
Thank you very much for your reply.
I recently made the decision to switch to Java and have only started learning. Currently am going through the SCJP for Java 5 from Kathy S. and Bert B. The book reads very well and I feel comfortable reading it although, I find Self Test questions quite difficult. I guess, I have given myself a tough deadline of three weeks to go through it and learn everything. Cannot even see my typing mistakes.
I didn't know where to start so I downloaded, from sun.com, the latest version of Sun Java Studio Creator (Version 2 Update 1 ) and I assumed it uses a compiler verson 1.5 or later. Maybe it doesn't.