0


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;
  }
}
Alexis C.
  • 87,500
  • 20
  • 164
  • 172
Beginner
  • 303
  • 1
  • 4
  • 15

1 Answers1

1

you need to add a getter in your enum :

public String getValue(){
    return this.value;
}
maximede
  • 1,653
  • 13
  • 23