> Object theInstance = solverClass.newInstance();
Oops I didn't notice the above
have you tried:
Class solverClass;
solverClass = loader.loadClass(solverName);
Solver theSolver = null;
try {
theSolver = (Solver)solverClass.newInstance();
}
catch (Exception e){ // more better exceptions available
log("couldn't cast, not a Solver!");
}
return theSolver;
***********************************************************
Brett Knights 626-432-5767 work
[EMAIL PROTECTED] 626-355-1017 home
***********************************************************
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> John Brecht
> Sent: Tuesday, May 04, 1999 12:22 PM
> To: Java Apache Users
> Subject: Re: Class casting problem...
>
>
> I'm pretty ignorant about this myself.
>
> I tried your suggestion and it doesn't compile:
>
> Error(202): method
> checkAttempt(edu.msu.lite.JHomework.Attempt, int) not
> found in class java.lang.Object
>
>
>
> John Brecht
> Department of Physics and Astronomy
> Michigan State University
> [EMAIL PROTECTED]
>
>
>
> > > theSolver = (Solver)(theInstance);
> >
> > Forgive my ignorance but why are you doing an explicit upcast?
> > I thought that sort of thing wasn't necessary in Java.
> > Why can't you make a direct call:
> >
> > theInstance.checkAttempt();
> >
> > ?
> >
> > ***********************************************************
> > Brett Knights 626-432-5767 work
> > [EMAIL PROTECTED] 626-355-1017 home
> > ***********************************************************
> >
> >
> >
> >
> > ----------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > READ THE FAQ!!!! <http://java.apache.org/faq/>
> > Archives and Other: <http://java.apache.org/main/mail.html/>
> > Problems?: [EMAIL PROTECTED]
> >
> >
>
>
>
> ----------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> READ THE FAQ!!!! <http://java.apache.org/faq/>
> Archives and Other: <http://java.apache.org/main/mail.html/>
> Problems?: [EMAIL PROTECTED]
>
>
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]