What is the difference between instanceof and Class.isAssignableFrom(…)?

When using instanceof, you need to know the class of B at compile time. When using isAssignableFrom() it can be dynamic and change during runtime.

Leave a Comment