【C012033】考虑下面这个简单的例子,让我们看看reflection是如何工作的。
import java.lang.reflect.*;
public class DumpMethods{
public static void main(String[] args) {
try {
Class c=Class.forName(args[0]);
Method m[]=c.getDeclaredMethods();
for (int i = 0; i < m.length; i++) {
System.out.println(m[i].toString());
}
} catch (Throwable e) {
System.err.println(e);
}
}
}
其中"c.getDeclaredMethods"的作用是:
A.取得类的公有方法对象
B.取得类的所有公有方法名称
C.取得类的所有方法对象
D.以上选项都不正确