Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java get class by string

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

//create instance of that class
Object myInstance = cls.newInstance();
 
PREVIOUS NEXT
Tagged: #java #class #string
ADD COMMENT
Topic
Name
4+2 =