tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Hartung" <>
Subject Re: instance of (ot)
Date Thu, 20 Feb 2003 19:37:06 GMT
> From: "Mike Jackson" <>
> 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).


Will Hartung

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message