Java反射機制中,基本的API

【前言】我是一個典型的離代碼很遠的程序員

 

反射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

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章