Selvarasu,
Welcome to CodeRanch!
It's commonly written that way because the driver might not be available at compile time or you switch drivers. For example, suppose you are working with an embedded database locally and Oracle in Production. You don't want to have to recompile the code.
This turns out to not be a problem much in practice as many applications look up the DataSource from the JNDI (in
Tomcat, WebSphere etc) and don't need Class.forName() either.