Back
What is the reflection in JAVA, and why is it useful?
I'm particularly interested in Java, but I assume the principles are the same in any language.
Reflection is an API and used to examine or modify the behavior of methods, classes, interfaces at runtime.
It gives us information about the class to which an object belongs and also tells us about the methods of that class which can be executed by using the object.
Usage of Reflection:
It's an Extensibility feature so it offers an application to use external, user-defined classes by creating instances of extensibility objects using their fully-qualified names.
They brake the abstractions and hence may change behavior with upgrades of the platform.
For more details and examples click here.
31k questions
32.8k answers
501 comments
693 users