I have the following enums with their value:
How can I convert the value of an enum to the enum? For example, from "Rocky" as input how can I set the enum of a class to ROCK?
I tried using valueOf like this:
gen gen1 = gen.valueOf("Rocky")
However, it throws an IllegalArgumentException of 'No enum constant'.
I have been really trying to figure this out even though I guess it's too easy but I'm a beginner. I had to instead take direct enum constant as input instead of the value of enum as input. But I want to know for knowledge on how I can convert the value of an enum to enum constant?