Friday, March 13, 2009

What actually does Class.forName("mypackage.MyDriver"); method

Question :What actually does Class.forName("mypackage.MyDriver"); method
do? (JDBC)

Answer :Class.forName("..."); initializes the provided class and returns the Class
object associated with the class or interface with the given string name.
For example, the following code fragment returns the runtime Class
descriptor for the class
named java.lang.Thread:
Class t = Class.forName("java.lang.Thread")

No comments: