I have a object of a class. I want to typecast it to another class. So, what we generally do is -
HeavyVehicle hv = new HeavyVehicle();
Truck tr = (Truck) hv;
if we typecast the hv object to truck classes object.
But if the name of the class is stored in a string like this-
String ToCastStringName = "Truck";
Is there any way to typecast the hv object to a class named ToCastStringName?