So, every Java text book talks about how flexible Java is since it can load classes at run time. Just cobble together a string and give it to Class.forName()
, and
It can be extremely useful in situations where you're using an API and the API designers actually deprecated some classes from one version to the next (for example the Contacts in Android).
Without reflection and dynamic class loading based on the string name, it would be impossible in this instance to have the same program run on both versions of the platform without getting a class not found exception at runtime. But with it, the same program was tweaked a bit and then could run on both platforms.