我不能訪問我的switch-case語句我枚舉變量:無法訪問枚舉值開關罩內/ Java的
public enum Country {
FRANCE(0, "France"), SPAIN(1, "Spain");
private final int code;
private final String name;
Country(int code, String name) {
// TODO Auto-generated constructor stub
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public String getName() {
return name;
}
}
在另一類有這樣的代碼:
public Drawable getFlag(){
Drawable d = null;
switch(country_id){
case Country.FRANCE.getCode():
break;
}
return d;
}
但問題是,當我輸入國家,只有班或這。