java get class by string name

Solutions on MaxInterview for java get class by string name by the best coders in the world

showing results for - "java get class by string name"
Diane
04 Mar 2016
1//get an according class variable
2String className = "MyClass";
3Class<?> cls = Class.forName(className);
4
5//create instance of that class
6Object myInstance = scl.newInstance();