How to convert Enum to String with Example


we can convert Enum to String by using toString Method..


For example


enum EnumToString{
a,b,c
}
public class EnumToStringMain{
public static void main(String args[]){
System.out.println(EnumToString.a.toString); //Here we convert enum value into String
}
}


Output is:
a

People who read this post also read :



1 comments:

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
Kindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India.
or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More