File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes new operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "new operator" Watch "new operator" New topic

new operator

aijazali chhachhar

Joined: Jan 12, 2012
Posts: 1
why we donot use new operator for laoding drivers?why class.forname
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3476

Class.forName() doesn't return an instance, it initializes a class and returns a Class object.
Class Class (It is not a typo).

So why forName()?
Because it allows you to instantiate a class that you don't know until runtime, so your code is more dynamic.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37926
And welcome to the Ranch aijazali chhachhar
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: new operator
Similar Threads
Question on operator precedence
question on jquery function
+ Operator in String
when vector created ??