Reflection is an advanced technique for creating an object and manipulating and invoking its members at runtime. This technique is especially useful when an implementing class is not known at compile time. For example, a Java application designed to work with multiple relational databases through JDBC would not know which JDBC driver to instantiate until the user decides what database to use. In this case, the JDBC driver can be instantiated by passing a string containing the fully-qualified class name to the application.
This chapter discusses what reflection is and shows how to use the Reflection API.
Reflection is a very useful Java feature. The following are examples of reflection in action.
▪ The JDBC ...