-
-
Save odornauf/2971c085b519737616cd1a097f80aec1 to your computer and use it in GitHub Desktop.
Java Enums with String values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum aEnum { | |
aValue ("value"), | |
aOtherValue ("string for value"), | |
aAddValue ("another value"); | |
private final String name; | |
private aEnum(String name) { | |
this.name = name; | |
} | |
public boolean equalsName(String otherName) { | |
return name.equals(otherName); | |
} | |
public String toString() { | |
return this.name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment