Creating objects using new operator has its own set of disadvantages. It leads to changes in code in future. Instead, loading classed dynamically using reflection makes the code more reusable. This post demonstrates this concept.
Reflection is a powerful feature of Java programming language to analyze Java classes and objects at runtime. We would examine this feature in detail in this chapter.
To begin with, we would first look into a small stand alone Java demo application. Then, step by step, we would look into various facets of Reflection by refactoring this application.