Answers for "java get enum from string"

1

java get enum from string

public enum Hello {
  A, B, C
};

val = Hello.valueOf("A") // Case sensitive and cannot have spaces in the string
val.equals(Hello.A) // returns true
Posted by: Guest on May-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language