We would like to know how to return a class' enums from its own class.
/*from w w w . j a v a 2 s. c o m*/ public class Main { static enum TestE { FOO, BAR } static class TestC { TestE getEnum(String name) { return TestE.valueOf(name); } } public static void main(String[] args) { System.out.println(TestE.FOO); System.out.println(new TestC().getEnum("BAR")); } }
The code above generates the following result.