This question already has an answer here:
I have a class name which is in external files. I want to create an instance for that class, and all the classes having common constructor which as string type.
Example:
'while (i < getData.size()) {
module = getData.get(i).getTestModule();
String format = "complete.package.name."
+ module + ".Test." + module + "Test";
Class<?> className = Class.forName(format);
}'
can somebody tell me how to create a constructor which can hold the string as it's input argument.
I used List as "getData" to get data and store in list. and looping each value, and need to invoke actual methods in class file.
Please help me to achieve this task.
Thanks, Sasi
Aucun commentaire:
Enregistrer un commentaire