Class in java can be loaded in two ways
Static means at compile time means using new operator.
Dynamic means using class.forname() a class is loaded dynamically during run time
so a decision to load a class dynamically at run time can be taken based on certain logic using property file etc.
getClass(); getName(); getDeclaredFields();
Instance can also be created using forName() method. It loads the class into the current class memory.
Instance can also be created using forName() method. It loads the class into the current class memory.
it is similar like Reflection.
No comments:
Post a Comment