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]
|
|