Let's say have a class name as string.
String myClass = "com.whatever.MyClass";
How can I instantiate this class using reflection and have an object of type MyClass and not Object, without using code like this:
MyClass myObj = MyClass.class.cast(instance);
Basically I want to convert an instance of Object to MyClass without using MyClass in code and just by knowing the class name as string.