Home > Back-end >  According to the name of the class instantiation of class and invoke methods
According to the name of the class instantiation of class and invoke methods

Time:04-04

 
Class<?> Clazz=Class. Class.forname (" com. Test. Test ");
The Object obj=clazz. GetDeclaredConstructor (). NewInstance ();
Method m=clazz getDeclaredMethod (" process ", parameter type 1. Class, parameter type (2) class);//parameter type is a custom class
M.i nvoke (obj, argument 1, argument 2);//instance methods

Called the Java. Lang. A NumberFormatException: null error, where is wrong?
  • Related