StupidBeauty
Read times:1304Posted at: - no title specified

转载 java 放射调用静态方法和构造函数

使用Method的invoke方法,第一个参数传入目标类的Class对象,就可以调用目标类的静态方法了。

http://www.cnblogs.com/yesun/archive/2007/10/11/920819.html

亮点

// 反射静态方法
Class c = Class.forName(" 类名 ");
m = c.getMethod(" 方法名 ", new Class[]{ 若干参数类型 });
// 得到返回的对象
Object objModel = m.invoke(c, new Object[]{ 若干参数 });

Your opinions

Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands