aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "new operator" Watch "new operator" New topic
Author

new operator

aijazali chhachhar
Greenhorn

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

Joined: Nov 08, 2003
Posts: 3479

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
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
And welcome to the Ranch aijazali chhachhar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new operator