• 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
Marshal
Posts: 53162
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch aijazali chhachhar
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!