A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Joined: Aug 24, 2004
Jun 07, 2005 12:13:00
i am going thru specification of
, and i found we can also create an instance of class using Class.forName(class_name).newInstance()
what advantage we can get using this approach instead of normal approach.
pls clarify me
Joined: Jan 14, 2005
Jun 07, 2005 12:32:00
with this way, you don't have to know the class name at compile time. see also the
for more information.
William A White
Joined: Jul 01, 2004
Jun 07, 2005 12:35:00
If you don't know what kind of object you want to create, this code lets you decide at run time.
You'd usually make use of it in conjunction with reflection, or some kind of factory that made different objects.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Object Creation
executeUpdate() returning unexpected results
My interview questions
Best way to search for an element in integer array
Batch Delete Problem
Running java program from another java program
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015