I done a method that receive a class and a int. I want to know if is possible and how I do to create an object from the passed Class parameters.
public void createObject(Class clazz, int n){
for(int i=0;i<n;i++){
//new object from the clazz
}
}
It’s possible to do this? I will create te objects to run in threads.
How can I assure that the Class implements Callable?
EDIT: it’s possible calling a Construcor with arguments?
Do you means like this?
If you have a constructor which takes arguments you can do