Wednesday, April 04, 2007

Reflection

Heard about reflection and want to know more about it.

Here you go...

http://java.sun.com/developer/technicalArticles/ALT/Reflection/

(Use the below post for knowing what Class.forName("")) does)

Tips:
newInstance() method is used to create a new object for the class.
getDeclaredMethods() is used to retrieve a list of Method objects, one for each method defined in the class. These include public, protected, package, and private methods.
getMethods() is used to obtain information for all public methods, even the inherited methods.
Both the getDeclaredMethods() and getMethods() returns a Method[].
A method can be invoked by calling the following metod passing the arguments as Object[]
invoke(new ClassName(), Object[]).

1 comment:

Unknown said...

veeru ... good work... en stop panneeteenga.. put more such topics....

nana