java ENUM error when using jdk 1.5

Hi,
I got some sample code and when I try to compile it I get the following errors. Any ideas how I can fix them

thanks
-anshu

----------------------------------------------------------------------------------------------------------

WritebackUtils.java:162: as of release 1.5, 'enum' is a keyword, and may not be
used as an identifier
(try -source 1.4 or lower to use 'enum' as an identifier)
    public static int getIntEnumVal(String enum) {
                                           ^
WritebackUtils.java:163: as of release 1.5, 'enum' is a keyword, and may not be
used as an identifier
(try -source 1.4 or lower to use 'enum' as an identifier)
        return Integer.parseInt(HTTPHelper.getEnumerationValue(enum));                                                              ^




anshumaEngineeringAsked:
Who is Participating?
 
VenabiliConnect With a Mentor Commented:
Rename your variable from enum to something else
enum is an identifier for the new enum type from 1.5 up so you cannot use it as a regular name for a variable

public static int getIntEnumVal(String enum) {
should be
public static int getIntEnumVal(String enum1) { //for example
and then change all references in the method itself
0
 
basav_comConnect With a Mentor Commented:
What said by Venabili is correct.
Following is the extra information. If it is OK to compile with javac 1.4 then you can try the following option to overcome the above error without changing the enum variables references in the code.
javac -source 1.4 <javafile.java>
0
 
anshumaEngineeringAuthor Commented:
You guys are awesome. Thanks a ton
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.