Create a new object of a subclass with a String

Thanks. I had to replace the getCanonicalName() with getName(), but now it works perfectly.