This question already has an answer here:
I would like to ask you guys if how can I instantiate an object from a string?
Ex:
Methods meth = new MethodsImpl();
Note: Methods = Interface MethodsImpl = Class
Is there anyway I can do that from a string? Something like this.
String thisMethod = "Method"
String thisMethodImpl = "MethodImpl"
thisMethod meth = new thisMethodImpl();
Something like that? I know its not possible but is there any way how I can do that? Im going to instantiate a dynamic object by the way.
thanks!
Aucun commentaire:
Enregistrer un commentaire