Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
class.forName ()
Hemant Agarwal
Ranch Hand
Posts: 138
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What is the use of class.forName ()
Manoj Kumkumath
Ranch Hand
Posts: 71
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It helps you to instantiate classes dynamically at the runtime
Pradeep Kadambar
Ranch Hand
Posts: 148
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Class.forName(className)
This does not instantiate a class. Rather it load the class with the classloader and returns the java.lang.Class object.
Jeff Albertson
Ranch Hand
Posts: 1780
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Well, one more step and you are there:
String className = ... read from xml config for example Class cls = Class.forName(className); Object object = cls.newInstance(); //Then, often you cast it to an appropriate interface, and off you go: Runnable r = (Runnable) object; new Thread(r).start();
There is no emoticon for what I am feeling!
Right! We're on it! Let's get to work tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JDBC connectivity
An JDBC problem
Dynamically loading a class
what this method do in JDBC?
How to connect MySQL DB from JSP?
More...