Dynamic Class Loading : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

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
Canadian Mind Products
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.

IP:[65.110.21.43]
Your face IP:[3.147.51.75]
You are visitor number