|
Help | Solution | API Docs | Expected Output
Skeleton Code
This magercise takes you through the steps to create a custom class loader. The class loader you are about to create works like the default
class loader, but instead of working with the See the Class Loading course section for additional information. Perform the following tasks:
Working from the
FileClassLoader.java skeleton, have
Find out if the requested class to
If the class isn't loaded, you'll need to convert the class name to a file name and load the data from the class. The filename conversion
is already done for you and the loading of the data is already done. The only thing you need to do is connect everything. Just call the
private
Once you have the class data in a byte array, convert the byte array into a Resolve the class definition if appropriate. Return the class object just created.
In the
CLTester.java skeleton, create an instance of the
Next, have the test program load a class whose name will be provided from the command line, also, as
After loading the class, create an instance of it. You can use reflection and the The Tester.java file contains a test class to use for the class loader. The only thing it does is print messages when the class file is loaded and instances are created. Save and compile the file.
If you have a "
Run the The task numbers above are linked to the step-by-step help page. Also available is a complete solution to the problem, and a demonstration of the expected behavior. Copyright © 1998 MageLang Institute. All Rights Reserved. | ||||
|
| ||||||||||||