What is reflection?

What is reflection?

Hi,

I want to know more about reflection in Java.

Thanks
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









Related Tutorials/Questions & Answers:
Version of ai.h2o>reflections dependency
Maven Repository/Dependency: ai.h2o | reflections
Advertisements
Maven Repository/Dependency: org.reflections | reflections-maven
Maven Dependency reflections >> 0.9.11-h2o-custom
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for reflections version 0.9.11-h2o-custom
Maven dependency for ai.h2o - reflections version 0.9.11-h2o-custom is released. Learn to use reflections version 0.9.11-h2o-custom in Maven based Java projects
Maven dependency for org.reflections - reflections-maven version 0.9.7 is released. Learn to use reflections-maven version 0.9.7 in Maven based Java projects
what is bit
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
What is procedure
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
What is Hibernate
What is Hibernate
What is Hibernate
What is JDBC?
What is FBT
What is ActionServlet?
What is Trigger?
What is VLR ?
What's PHP ?
What is an interface?
What is DML?
What is Index?
What is SQLLoader?
What is a "constraint"?
what is Savepoint ?
What is this keyword?
what is collections?
what are indices?
What is Hibernate
What is Externalizable?
What is the % operator?
What is casting?
What is DataAccessException?
What is IOC ?
What is SQLExceptionTranslator?
What are Struts?
What is WAP?
What is SPOOL?
What is CRM?
What is webservices?
What is Ajax?
What is NSRangeException
What is portal
what is posting?
What is a tuple?

Ads