Invalid cast type error

From: Glenn Robinson (Glenn_at_Flying-Fields.co.uk)
Date: 08/26/04


Date: Thu, 26 Aug 2004 06:21:26 +0100

Hello,

I create a new class object at runtime using:

    Class dmClass = Class.forName(dmClassName);

I want to be able to use the Class object, dmClass, to cast new objects but
I can't seem to get this to work. I've tried:

(dmClass) .......
(dmClass.getName()).....

But I get an Invalid Cast type expression error.

How can I use dmClass as the cast type in a statement?

Thanks

-- 
Glenn


Relevant Pages

  • Invalid cast type error
    ... I create a new class object at runtime using: ... But I get an Invalid Cast type expression error. ... How can I use dmClass as the cast type in a statement? ...
    (comp.lang.java.programmer)
  • Re: Invalid cast type error
    ... Glenn Robinson wrote: ... > I create a new class object at runtime using: ... > How can I use dmClass as the cast type in a statement? ...
    (comp.lang.java.programmer)
  • Re: Invalid cast type error
    ... Glenn Robinson wrote: ... > I create a new class object at runtime using: ... > How can I use dmClass as the cast type in a statement? ...
    (comp.lang.java.help)
  • Re: Invalid cast type error
    ... Subject: Invalid cast type error ... I want to replace the hard coded SasDMImp with dmClass but I get the Invalid ... Cast type when I do this. ...
    (comp.lang.java.programmer)
  • Re: Java Typecasting Internals
    ... to allow the cast to proceed. ... efficiently implement instanceof. ... You could prepare a list of all those left superclass class object ...
    (comp.lang.java.programmer)