isAssignableFrom() vs. instanceof
In Java, you can check the class of an object using the instanceof operator:
microwave instanceof OvenWhen you have a Class object, it would make sense to write:
microwave.getClass().isAssignableTo(Oven.class)Unfortunately, there is no isAssignableTo. It has to be written the other way round:
Oven.class.isAssignableFrom(microwave.getClass())