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;
}
}
you need to add a getter in your enum :
public String getValue(){
return this.value;
}
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.