by
0
5
2,013
2
Top 1% !
Popular
Famous
Specified
OpenSource
Popularity: 10778th place
No tags for this snippet yet.
Languageprocessing
LicenseMIT_X11
MethodNametoString
OutputTypeString

Java enum example

Enum class with private constructor and toString() as overridden method
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/459559/Java-enum-example?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public enum MyEnum { Enum_enable("enable"), Enum_test("test"); private final String enumName; private MyEnum(final String name) { this.enumName = name; } @Override public String toString() { return this.enumName; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus