| Author |
Dynamic and Static class loading...
|
Nittin singla
Greenhorn
Joined: Jul 02, 2011
Posts: 24
|
|
Hi all,
I have a question regarding static and dynamic class loading. I do understand that by writing the new operator, we are statically loading the class and by writing class.forName(), we are dynamically loading the class. My question is that under what conditions do we use dynamic class loading, where loading a class dynamically would make a difference.?
Thanks in advance,
Nittin
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
That sounds like one of those things you don't actually have to know about. What's more, it might vary from implementation to implementation.
If you search, you find there are a few probably relevant old questions: 1 2 3 4 (with a link to an older thread) 5 ... and there were others.
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3793
|
|
|
One situation is if you don't know at compile time what the name of the class is - e.g. it needs to be read from a configuration file.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
|
But do you call that dynamic or static? Do you use the terms dynamic and static in this context at all?
|
 |
 |
|
|
subject: Dynamic and Static class loading...
|
|
|