You are here: Re: methods of a class « PHP Programming Language « IT news, forums, messages
Re: methods of a class

Posted by Carl on 06/06/07 22:11

"Jon Slaughter" <Jon_Slaughter@Hotmail.com> writes:

> is it possible to iterate through the methods in a class?
>
> Thanks,
> Jon

If you want to see the public member methods you can do
something like this:

----8<----
package test;

import java.lang.reflect.Method;

public class Test {

public static void main(String[] args)
throws ClassNotFoundException {
Class c = Class.forName("java.lang.reflect.Method");
Method methods[] = c.getMethods();
for (Method m : methods) {
System.out.println(m);
}
}
}
---->8----

Docs here:
http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getMethods()

Hope that helps,
Carl.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация