Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

new operator

 
aijazali chhachhar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why we donot use new operator for laoding drivers?why class.forname
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch aijazali chhachhar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic