Let's say I have an object created from class:
public Class Cat {
public Cat(String name) {
this.name = name;
}
}
Cat cat = new Cat("Just cat");
I create a Class-instance of my cat like this:
Class catClass = cat.getClass();
My question is, can I use that Class-object to create cats by doing something like this:
Cat newCat = catClass...something...("Another cat");
My problem is that I have a method accepting array of strings. This method needs to decide which object it has to construct using these strings as arguments. I tried to use getConstructor methods, but I can't seem to figure out how this works.