I'd like to know what is wrong with my code
public static enum e_option
{
HELP,
AUTHOR,
PROJ_NAME,
DESC,
MAIN_CLASS_NAME,
BASE_DIR,
XML_NAME,
RULE_OPT,
UNKNOWN
}
the i have this method which is
public e_option s2i(String arg)
{
e_option opt = null;
if (arg.equals("--help"))
{
opt = HELP;
}
if (arg.equals("--author"))
{
opt = AUTHOR;
}
}
the problem is eclipse doesn't recognize HELP and AUTHOR. It suggest me to create new constants which is bizzare.
要获取enum
的值,您必须使用其名称:
opt = e_option.HELP;
为什么不尝试使用e_option.HELP而不是HELP?
您需要指定枚举名称:
opt = e_option.HELP;
除其他事项外,您承诺返回e_option是错误的,但是您没有这样做。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.