While connecting to MySQL database I do following steps
Connection con = null;
Resultset rs = null;
Statement st = null;
Class.forName(\"com.mysql.jdbc.Drive
The Class class is located in the java.lang package, so it is distributed with java, and imported automatically into every class.
What the forName() method does, is just return the Class object for the paramater that was loaded by the class loader. The newInstance() method then returns a new instance of the class.
So then what happens is you call
Class.forName(...)
it returns com.mysql.jdbc.Driver.class.
You then call newInstance() on that class which returns an instance of the class, whith no paramaters, so it's basically calling new com.mysql.jdbc.Driver();.