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());