Ryan Clark

Greenhorn
+ Follow
since Jun 23, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ryan Clark

Hey Sudheer,

Java reflection is a technique your program can use to see and modify its own structure. If you don't know what kind of class you have or what its methods are, you can use reflection to find out, then instantiate and call methods on that object. And if I remember correctly, you can view method signatures through reflection, but you can't see the implementation.

As for practical application, I once had to write a web app that could test any kind of class (new classes could be added and we didn't want to change our app). To test them, I used reflection to instantiate the object and get a list of methods to show the user. Once they picked a method, I'd let them enter data, called the method, and returned the output to the user.

Hope this helps! (It's my first post!)
15 years ago