When do I need to use reflection feature in Java?

When do I need to use reflection feature in Java?

Reflection feature in java allows an executing java program for introspecting upon itself. It also allows for manipulating internal properties of the program. For instance, it is possible to obtain the names of all members of a Java class and displaying them, using reflection feature. It reflects the classes, objects and interfaces in the concurrent JVM. This API can be used for writing certain developing tools such as debuggers, class browsers, and GUI builders.

The following are the operations which can be done by reflection feature:

- Determine the class of the object
- Finding the methods declaration, constants of an interface.
- Creating an instance of a class without knowing the name until runtime
- Values of an object’s fields can get and set, even the field name is not known.
Explain how to measure time in nanoseconds - Java
Time is measured in nanoseconds by using the method nanoTime() method. This method returns the current value of the most precise system timer available in nanoseconds...
Java Thread: run() vs start() method
The method start() invokes the run() method. If the run() method of two threads invoked separately, they will execute one after the other...
What is Java Isolates and why do we need it?
Java Isolates is an API. It provides a mechanism to manage Java application life cycles which are isolated from each other. They can potentially share the underlying implementation resources...
Post your comment