Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

What is reflection?

Ads

 
 

Share on Google+Share on Google+

Deepak Kumar
What is reflection?
2 Answer(s)      6 years and 10 months ago
Posted in : Java Beginners
Hi,

I want to know more about reflection in Java.

Thanks
Ads
View Answers

October 5, 2010 at 5:41 PM


Hello,
Through reflection you can do activity at runtime or examine the exceutting java programm.

ex= through bello programm you can get all the list of method of MyClass
same like this you can get all declared field Through Field Class of reflection packege.
Class c = Class.forName("MyClass");
Method m[] = c.getDeclaredMethods();
for (int i = 0; i < m.length; i++)
System.out.println(m[i].toString()); //It will give you all
//methods declared in MyClass
}
Thanks


October 5, 2010 at 5:45 PM


Hi Friend,

It is a powerful approach to analyze the class at runtime.It allows programmatic access to information about the fields, methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions.

For more information, visit the following link:

http://www.roseindia.net/java/reflect/

Thanks

Ads