Dynamic Class Loading : Java Glossary


Dynamic Class Loading
You can dynamically load a class, and create objects of that class just by knowing its name as a String. Typically you would cast the objects created to some interface so that you could invoke methods on it.
Class c = Class.forName( "com.mindprod.mypackage.Myclass" );
Thing t = (Thing)c.newInstance( );
t.doSomething();

This page is posted
on the web at:

http://mindprod.com/jgloss/dynamicclassloading.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\dynamicclassloading.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[54.197.218.127]
You are visitor number