O'Reilly logo

Java™ 7: A Comprehensive Tutorial by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 30

Reflection

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.

Overview

Reflection is a very useful Java feature. The following are examples of reflection in action.

 

▪  The JDBC ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required