ead-write lock allows multiple threads to acquire a read lock provided no other thread currently has a write lock on the same object. A thread can acquire a write lock if no other thread owns either a read lock or a write lock.
Many times you are not able to tell exactly which class will be instantiated, until the runtime. In these situations you want to be able to create an object through some identifier such as the name of the class. This is one of the abilities that Reflection API of Java provides.