Yeah, I know. Long title of question... So I have class name in string. I'm dynamically creating object of that class in this way:
String className = "com.package.MyClass";
Class c = Class.forName(className);
Object obj = c.newInstance();
How I can dynamically convert that obj to MyClass object? I can't write this way:
MyClass mobj = (MyClass)obj;
...because className can be different.