Training „git“
07.10.2010 - 08.10.2010, Essen
Training „Eclipse RCP“
28.03.2011 - 01.04.2011, Dortmund
23.01.2009

Java Snippets: Class.isAssignableFrom() vs. instanceof

For some reason I have to think about the meaning of Class.isAssignableFrom() everytime I use it. That’s because I’m used to the meaning of the instanceof operator:

microwave instanceof Oven

On the Class level, I’d like to write:

Microwave.class.isAssignableTo(Oven.class)

Unfortunately, it’s written the other way round:

Oven.class.isAssignableFrom(Microwave.class)
foo, 06. Januar, 14:38 Uhr

Thanks! This (and Google) helped me a lot :-)

I'm looking forward to your comments:

Schulungen

Java

Ralf Ebert | Blog | Java | Java Snippets: Class.isAssignableFrom() vs. instanceof