提示 Class<?> clz = Class.forName("A"); 报错,想咨询一下是什么原因呢,谢谢
package files;
public class file5 {
public static void main(String[] args) throws Exception {
Class clazz = Class.forName("files.file5$A");
System.out.println(clazz.getMethods()[0]);
}
public static class A {
public void hello() {
System.out.println("hello world");
}
}
}
那肯定是找不到的啊。Class.forName("全限定类名");
改为:Class.forName("files.A");
如有帮助,请采纳。点击我回答右上角【采纳】按钮。
都提示找不到类啊 使用完全限定名试试 或者类.getClass