enum in JDK 1.5.07

Hi everyone,

I am new to Java 5, and I am try to recompile the code below in learning the enum, but I got some compiling error such as around the enum. It said that "Syntac error on token "enum" ....

If you have worked through this problem, could you please let me know what is wrong from my code, thanks for your help!

Dung.

--

package chapter3;

public class EnumTest {

public static void main(String[] argv) {

if ( argv.length < 1 ) {

System.out.println("Usage: java EnumTest [num char]");

System.exit(1);

}

else {

NUM_INFO ni = Enum.valueOf(

NUM_INFO.class, argv[0].toUpperCase());

System.out.println(

"Char : " + ni.getNumChar() + "\n" +

"Value: " + ni.getNumValue()

);

System.out.println("Name of the Num Info : " + ni.name());

}

}

}

enum NUM_INFO {

ONE ('1', 1.0/6.0),

TWO ('2', -2.0/6.0),

THREE ('3', 3.0/6.0),

FOUR ('4', -4.0/6.0),

FIVE ('5', 5.0/6.0),

SIX ('6', -6.0/6.0);

private final char numChar;

private final double numValue;

NUM_INFO(char numChar, double numValue) {

this.numChar = numChar;

this.numValue = numValue;

}

public char getNumChar() {

return this.numChar;

}

public double getNumValue() {

return this.numValue;

}

}

[1414 byte] By [dungtoa] at [2007-11-26 14:29:42]
# 1
Sorry, the code is fine. My IDE was set to use the JDK1.4 caused the compiling errors. Thanks!
dungtoa at 2007-7-8 2:24:08 > top of Java-index,Java Essentials,New To Java...