Hi harshit. If you use Class.forName(), then you are not required to have any compile-time dependencies on a particular JDBC driver. This is particularly useful when you are writing code that can work with a variety of databases.
Consider the following code:
// Register the PostgreSQL driver
Class.forName("org.postgresql.Driver");
Now compare it to:
import org.postgresql.Driver;
// Register the PostgreSQL driver
DriverManager.registerDriver(new Driver());
And consider that in the first example, the class name could also have come from a properties file, XML file, etc., depending on what's convenient for your application.