【前言】我是一个典型的离代码很远的程序员
反射API:
测试用的TestClass:
运行结果:
***************************
The class to be load is:
class test2.TestClass
***************************
The package TestClass belong to:
package test2
***************************
Get the Modifiers of the TestClass
1
public
false
***************************
Get the name of class:
test2.TestClass
***************************
Get type of TestClass
***************************
Get the super Class:
java.lang.Object
***************************
Get the interface immplemented by TestClass:
java.lang.Comparable
***************************
Get the inner class of TestClass:
***************************
Get the constructor of TestClass:
public test2.TestClass(int,java.lang.String)
public test2.TestClass()
***************************
Get the Fields of TestClass:
private int test2.TestClass.id
private java.lang.String test2.TestClass.name