This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Dynamic and Static class loading... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Dynamic and Static class loading..." Watch "Dynamic and Static class loading..." New topic
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
    
    4
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
    
    1

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
    
    4
But do you call that dynamic or static? Do you use the terms dynamic and static in this context at all?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Dynamic and Static class loading...
 
Similar Threads
Need for Class Loading using Class.forName
dynamic class loading
Static class loading and dynamic class loading
Static and Dynamic class loading
Static Initializers and Static, Dynamic class loading