jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes class.forname...working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class.forname...working" Watch "class.forname...working" New topic


Kunal Choudhary

Joined: Feb 25, 2009
Posts: 14
can anybody please explain the actual working of the class.forname() method....esp with reference to the memory.....the concepts....also what happens when i say "class.forname(oracle.jdbc.driver);".....what happens internally
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43898
The JVM (probably a ClassLoader) finds the class of that name and loads a Class<T> object into the memory used by the JVM. In the case of the JDBC connector classes, I believe there is a static initialiser block which initiates the connection to the database.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Whenever a class gets loaded, all of its static variables get initialized and static initializer blocks get fired. You know, 'static' applies on the class itself and has no instance dependence.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: class.forname...working
It's not a secret anymore!