Post a Job  |   Ask a Question?   |   Already registered? login or register
phani varma
05/05/2016 11:43 AM

why to use class.forname to load a driver does it really loads the driver???

first of all we have to understand what is class.forname 1)forname is a method of Class which class name is a "Class" the forname method is used to load the static block in any Class. so when we say Class.forname("com.mysql.jdbc.Driver"); the Class.forname loads Driver class and execute the static block and the static block calls the method registerdriver which registers the driver so the class.forname is not which registers the driver it is actually the static block of Driverclass which registers the driver so the Class.forname which is just loads the driver class so that we can register the driver in the static block.
Spam    0 Comments

Languages :