First of all, I have Enum inside the class e.g. :
public class MyABC
{
String temp = "allow";
....
public enum Steps{ Step1,Step2,Step3 }
....
}
Now I want to access Enum -"Steps" from other package, but was not able to find specific method for that.
I am able to find values with below code where class is in given project,
Class<?> myClass = com.....MyABC.Steps.class;
System.out.println(Arrays.asList(myClass.getEnumConstants()));
But I am getting classNotFound when I am using like
try {
Class<?> myclass = Class.forName("com.....MyABC.Steps");
System.out.println(Arrays.asList(myClass.getEnumConstants()));
} catch (Exception e) {
exception....
}
Aucun commentaire:
Enregistrer un commentaire