Blueimp 論壇首頁
  首頁  | 討論區  | 最新話題  | 搜尋  | XML  |  登入

此話題中所有文章數: 1 [ 話題狀態: 一般 ]
上一話題 此文章已經觀看 22 次 而且有 0 篇回應 下一話題
會員大頭照
男寶寶 Moonnight 《護衛隊長》
文章: 716
v3.8.8

list all method from class


package test.fin.test;

/**
* Title: 找出 class 內所有 method
* Description:
* Copyright: Copyright (c) 2005
* Company:
* @author Fin
* @version 1.0
* @JDK 1.3.1
*/
public class Test1 {

public Test1() {
}
// list all method from class
private void test1(Class clazz) {
java.lang.reflect.Method[] m = clazz.getDeclaredMethods();
for ( int i = 0 ; i < m.length ;i++ ) {
System.out.println(m.getName());
}
}

private void test2() {
// empty for test list method
}

public static void main(String[] a) {
Test1 test =new Test1();
test.test1(Test1.class);
}
}

----------------------------------------
[編輯文章 2 次, 最後修改: Moonnight 於 2005/9/7 上午 10:45:37]

[2005/7/5 上午 11:23:54]   [返迴此篇文章頂端 ]  回到頂端