java get enum from string

Solutions on MaxInterview for java get enum from string by the best coders in the world

showing results for - "java get enum from string"
Angela
21 Feb 2016
1public enum Hello {
2  A, B, C
3};
4
5val = Hello.valueOf("A") // Case sensitive and cannot have spaces in the string
6val.equals(Hello.A) // returns true