文件名称:java Reflection 反射机制 反编译
文件大小:2KB
文件格式:JAVA
更新时间:2013-12-20 02:18:55
java Reflection 反射机制 反编译
package day29; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; public class ReflectionTest { public static void main(String[] args) { Class c = null; try { c = Class.forName("java.lang.String"); System.out.println("package " + c.getPackage().getName() + ";\n"); System.out.print(Modifier.toString(c.getModifiers())); System.out.print(" class " + c.getSimpleName()); System.out.print(" extends " + c.getSuperclass().getSimpleName()); Class[] inters = c.getInterfaces(); if (inters.length > 0) { System.out.print(" implements "); for (int i = 0; i < inters.length; i++) { System.out.print(inters[i].getSimpleName());