[josm-dev] Java question

David Earl david at frankieandshadow.com
Sun Feb 24 14:38:54 GMT 2008


On 24/02/2008 14:21, Hakan Tandogan wrote:
> David Earl wrote:
>> My Java knowledge has let me down and I haven't been able to frame a 
>> suitable Google query. Can someone tell me how in Java I test whether 
>> some object is a subclass or superclass of some class (or other object)?
>>
>> I know how to ask if something is an instance of a particular class 
>> (o.class() == C.class) but if o could be a subclass of c how do 
>> express this?
> 
> if (o typeof c) ?

Thanks. It's actually
   if (o instanceof c) ...
that I need, but typeof was enough for me to get a google search to tell 
me the answer.

David







More information about the josm-dev mailing list