Is it possible in Java to take a collection of classes with parameterized constructors and instantiate each one of them at run time? These classes have only one constructor that can take any number of primitive type arguments, though the number of arguments they take can vary for each class. As an example, here are four classes that we want to instantiate at run time:
public class One { public One(int a) { } }
public class Two { public Two(char a, int b) { } }
public class Three { public Three(float a, char b, int c) { } }
public class Four { public Four(float a, char b, int c) { } }
Aucun commentaire:
Enregistrer un commentaire