By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,468 Members | 1,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,468 IT Pros & Developers. It's quick & easy.

Need help with enums in java 1.5

P: n/a
I am trying to compile the following java code with the beta version
of java 1.5.
import java.*;

public class hello {

public enum test { a, b, c, d, e };
public static void main(String[] args){
System.out.println("hello world");

}
}

I get the following error:

$ javac hello.java
hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not be us
ed as an identifier
public enum test { a, b, c, d, e };
^
hello.java:5: ';' expected
public enum test { a, b, c, d, e };
^
1 error
1 warning

Am is missing something ?
Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Parag" <dv***@routepulse.com> wrote in message
news:38**************************@posting.google.c om...
I am trying to compile the following java code with the beta version
of java 1.5.
import java.*;

public class hello {

public enum test { a, b, c, d, e };
public static void main(String[] args){
System.out.println("hello world");

}
}

I get the following error:

$ javac hello.java
hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not be us ed as an identifier
public enum test { a, b, c, d, e };
^
hello.java:5: ';' expected
public enum test { a, b, c, d, e };
^
1 error
1 warning

Am is missing something ?
Thanks


Yes, you are missing the -source 1.5 directive to your compiler.

Silvio Bierman
Jul 17 '05 #2

P: n/a
Thanks, that did the trick.

"Silvio Bierman" <sb******@idfix.nl> wrote in message news:<40***********************@news.xs4all.nl>...
"Parag" <dv***@routepulse.com> wrote in message
news:38**************************@posting.google.c om...
I am trying to compile the following java code with the beta version
of java 1.5.
import java.*;

public class hello {

public enum test { a, b, c, d, e };
public static void main(String[] args){
System.out.println("hello world");

}
}

I get the following error:

$ javac hello.java
hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not

be us
ed as an identifier
public enum test { a, b, c, d, e };
^
hello.java:5: ';' expected
public enum test { a, b, c, d, e };
^
1 error
1 warning

Am is missing something ?
Thanks


Yes, you are missing the -source 1.5 directive to your compiler.

Silvio Bierman

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.