aspose file tools*
The moose likes Java in General and the fly likes Multiple loading of a class thru Class.forName() ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Multiple loading of a class thru Class.forName() ??" Watch "Multiple loading of a class thru Class.forName() ??" New topic
Author

Multiple loading of a class thru Class.forName() ??

Mahendra Shelke
Greenhorn

Joined: May 08, 2006
Posts: 20
Hello Ranchers ,

Does a class gets loaded twice in the memory if i call it twice in my code using Class.forName() ?



will this load the driver in the memory twice or do i have take care of it using a static block ?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The class will only be loaded once. As long as the second one asks the same ClassLoader to load the Class, nothing will happen. It is however possible for the class to be loaded if another ClassLoader is specified, but not guaranteed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple loading of a class thru Class.forName() ??