To convert a string to enum in Java you can use the following snippet.
Considering the following enum.
Sample Java
public enum Testenum { One,Two,Three,Four }
you can cast an string to enum like this:
Sample Java
Testenum.valueOf("Two");
All the Code Snippets and Samples you need
To convert a string to enum in Java you can use the following snippet.
Considering the following enum.
public enum Testenum { One,Two,Three,Four }
you can cast an string to enum like this:
Testenum.valueOf("Two");
You must be logged in to post a comment.
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets
RT @CodeSnippetsNET: How to convert a string to enum in #Java http://t.co/Hz2Ardf3K1 #coding #javascript #js #programming #codesnippets