tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Hartung" <wi...@msoft.com>
Subject Re: instance of (ot)
Date Thu, 20 Feb 2003 19:37:06 GMT
> From: "Mike Jackson" <mjackson@cdi-hq.com>
> Sent: Thursday, February 20, 2003 11:06 AM
> Subject: RE: instance of (ot)


> Perhaps you ought to post a snippet of what doesn't work.  I personally
> haven't had any problems with "instanceof", but without seeing what you're
> doing I don't think any of us can help.

The problem is that 'instanceof' does not take an expression on its Right
Hand Side, rather it must be a class specifier.

So this:

Class c = anObject.getClass();
boolean b = anObject instanceof c;

does not compile.

However, this SHOULD work:

Class c = anObject.getClass();
boolean b = c.isInstance(anObject);

I think that's what he wants. (I haven't tested this).

Regards,

Will Hartung
(willh@msoft.com)





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message