Yes. If your class has a no-arg constructor, just do like this:

void method(Class c)
        {
        ...
        Object o = c.newInstance();
        ... // use 'o'
        }

Otherwise, look for a Constructor class documenation from
java.lang.reflect package to create and initialize your object with a
constructor with parameters.

All the Best
Pavel

Wim Ceulemans wrote:
> 
> Hi
> 
> Does anyone has experience in passing a class as a parameter in java?
> 
> I want to do something like call a method with as parameter a class name and
> then create instances of that class in that method. Is this possible?
> 
> Regards
> Wim Ceulemans
> Nice Software Solutions
> Eglegemweg 3, 2811 Hombeek
> Tel 0032-15-41-29-53 Fax 0032-15-41-29-54

Reply via email to