Getting Class type from String
Class<?> cls = Class.forName(className);
But your className
should be fully-qualified - i.e. com.mycompany.MyClass
String clsName = "Ex"; // use fully qualified name
Class cls = Class.forName(clsName);
Object clsInstance = (Object) cls.newInstance();
Check the Java Tutorial trail on Reflection at http://java.sun.com/docs/books/tutorial/reflect/TOC.html for further details.