Best way to create enum of strings?

I don’t know what you want to do, but this is how I actually translated your example code….

package test;

 * @author The Elite Gentleman
public enum Strings {

    private final String text;

     * @param text
    Strings(final String text) {
        this.text = text;

    /* (non-Javadoc)
     * @see java.lang.Enum#toString()
    public String toString() {
        return text;

Alternatively, you can create a getter method for text.

You can now do Strings.STRING_ONE.toString();

Leave a Comment