problem in declaring enum
public enum ItemType{REFRENCE,ISSUE};
ItemType itemType = IntemType.ISSUE ;
int开发者_Go百科 intemNo=0;
I am geting error wheni use above code?why is it so?
- The code you provided (still) contains a typo: it's either
IntemType
orItemType
- Make sure, you use Java 1.5 or later. Earlier versions of Java do not support enums
- Make sure, you compile with source level 1.6. It's one of my favourite mistakes in eclipse to use a Java 6 SDK and have a project configured for source level 1.4 ...
Your declaring an interface - an interface can't have fields. Declare it as a class- If none of the above helps - please edit your question and add error details.
Thanks for the comment, from JLS
Every field declaration in the body of an interface is implicitly public, static, and final.
Did you compile with setting "source java 1.5"? The enum syntax was't supported before java 1.5.
精彩评论