This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Class.forName Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class.forName" Watch "Class.forName" New topic
Author

Class.forName

Deena Raj
Greenhorn

Joined: Mar 01, 2007
Posts: 7
What is the difference between Class.forName and creating an object using new Abc()
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Class.forName() loads a class. The "new" operator creates an instance of a class.
Srikanth Ramu
Ranch Hand

Joined: Feb 20, 2007
Posts: 76
Class.forName() returns the "Class" object associated with ABC() and not a new instance of ABC().

For more details refer:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html
 
Consider Paul's rocket mass heater.
 
subject: Class.forName
 
Similar Threads
How to connect MySQL DB from JSP?
Dynamically loading a class
what this method do in JDBC?
An JDBC problem
JDBC connectivity