Hello I need help creating a program in Java. Basically I need to use ClassLoader to load classes at runtime that implements a particular interface (the name and location will be known). From what I see on the api, there's a loadclass method that gives you a Class object, but how do you construct an Object of that class? So if I have Class class, and it's of a class Demo do I do this: Demo dem = class(int something, ...)?

Also are all the methods of ClassLoader implemented? I noticed that it's abstract.

Every time I Google for a tutorial, all I get are tutorial of how to make your own custom Class Loader

Recommended Answers

All 2 Replies

Read the API for Class, namely the newInstance() method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.