Convert Enum To String Java Code Example


Example 1: enum value to string


class Program.
static void Main(string[] args)
{
Enum wkday = Weekday.Friday;
Console.WriteLine("Enum string is '{0}'", wkday.ToString());
Console.ReadKey();
}

Example 2: java enum to string


public enum MyEnum{
SOMETHING,SOMETHING_ELSE
}
MyEnum enumObject=MyEnum.SOMETHING;
System.out.println(enumObject.toString());
System.out.println(enumObject.name());

Example 3: enum to string java


yourEnum.name()

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable