Reputation: 313
How to get the value Apple if I pass A ...
public enum Enumtype {
A("Apple"), B("Ball"), C("Cat");
private String value;
private Enumtype(String value) {
this.value = value;
}
}
Upvotes: 0
Views: 85
Reputation: 1823
you need to add a getter in your enum :
public String getValue(){
return this.value;
}
Upvotes: 0