Answers for "java relection string to classname"

-1

java get class by string name

//get an according class variable
String className = "MyClass";
Class<?> cls = Class.forName(className);

//create instance of that class
Object myInstance = scl.newInstance();
Posted by: Guest on December-26-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language