This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Class.forName() is used to dynamically loading the code given in the name of the class which had given as a argument .here runtime only it will know about the class name.
Class.forName() Returns the Class object associated with the class or interface with the given string argument . Invoking this method is equivalent to:
where currentLoader denotes the defining class loader of the current class..
JVM executes all its static blocks after class loading. Everything you need to be initialized should be placed into static block. Static blocks are executed when the class is loaded.All JDBC Drivers have a static block that registers itself with DriverManager and DriverManager has static methods only.. The static block in question here registers itself with the DriverManager.
so it will register your JDBC driver .....