In a traditional programming environment this seems like a far-fetched scenario. But as we move into a larger programming world there are important cases in which this happens. These components are then configured by setting some of their values at program time. This design-time configuration requires that any component be instantiable and that it expose some part of itself and allow its values to be read and set. In addition, components that handle GUI events must expose information about appropriate methods so that the RAD environment can assist the programmer in overriding these event-handling methods.
Reflection provides the mechanism to detect the available methods and produce the method names.
Another compelling motivation for discovering class information at run-time is to provide the ability to create and execute objects on remote platforms across a network. Objects of these types are created by the JVM at run-time to represent the corresponding member in the unknown class. Thus, the class information for anonymous objects can be completely determined at run time, and nothing need be known at compile time. It's important to realize that there's nothing magic about reflection. Thus, the .class file for that particular type must still be available to the JVM, either on the local machine or across the network.