I have a method that uses an enum:
mymethod(AnotherClass.MyEnum.PassedEnum);
And I want to nest this within a class that receives a String which becomes MyEnum:
public static void method(String toPass){
mymethod(AnotherClass.toPass.PassedEnum);
}
The passed variable has to be a String but I need to convert it to a Enum to pass to AnotherClass?
TIA
Answer
Use AnotherClass.MyEnum.valueOf(toPass)
No comments:
Post a Comment