Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

enums with values in java

public enum Element {
    H("Hydrogen"),
    HE("Helium"),
    // ...
    NE("Neon");

    public final String label;

    private Element(String label) {
        this.label = label;
    }
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #enums #values #java
ADD COMMENT
Topic
Name
2+3 =