首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

eclipse中enum有关问题

2012-12-23 
eclipse中enum问题用eclipse写程序,用到enum系统提示:the type Enum is not genericit can not be parame

eclipse中enum问题
用eclipse写程序,用到enum
系统提示:
the type Enum is not generic;it can not be parameterized with arguments
是怎么回事?
[解决办法]

public enum XXX {
A(0),
//没有中间页
B(1);
private int code;

private XXX (int code){
this.code=code;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

[解决办法]
package com.lss.tm.enums;

//参考一下。我经常会这样写
public enum Status {
Normal(1, "正常"), Freeze(0, "冻结");
private Integer id;
private String name;

private Status(Integer id, String name) {
this.id = id;
this.name = name;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}
}

[解决办法]
是不是在enum中使用了泛型?把你的代码贴出来看看?
[解决办法]
the type Enum is
这里的提示是Enum,而不是enum
[解决办法]
贴一下代码。
另外,细说一下你在eclipse中编译该工程所使用Java版本。

热点排行