0

my eclipse doesn't recognise enum as keyword. I copied source code from oracle's site. And everything is good except enum part

public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY 
}

where for enum is error "enum cannot be resolved to a type"...

Do i need to import something or what? I googled for answer, but that didn't work for me...

Thank you all, Matija

EDIT: Eclipse still don't recognise enum as keyword. I tried all from simmilar question and still don't work...

I can't reply my question because my reputation is too low, and i can't post pictures that show my compiler compilance level is 1.7 and i checked for all execution enviroments that they are compatible with jre8...

Thank you all for your time, Matija

2 Answers2

1

Check your project Java Compiler settings. Java level should be at least 1.5. That's when enum keyword was introduced.

pkuhar
  • 581
  • 6
  • 17
1

Please make sure that your JDK version should be at least 1.5. Becase ENUM keyword is introduced in this version.

You can look up you JDK version by this way:

Preferences-java-compiler-JDK compliance.

niushuai
  • 98
  • 5