What is reflect package used for & the methods of it?

What is reflect package used for & the methods of it?

The java.lang.reflect package provides the information about the code, i.e. objects and classes.

Reflection provides the programmatic access to variables, methods, constructors to operate on objects.

 It is used to retrieve the member information for any loaded class. 

 Example:Class a=Class.forName(\"java.lang.String\");Method m[]=a.getDeclaredMethods();java.lang.reflect package provides classes such as Method,Modifier,Field,Constructor,Proxy etc. Using these classes we can retrieve the needed information of the loaded class.


By:Jalees
Date:2011-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher