How to check that class B inherits from class A? (java)


When we have an object of type B and class A, everything is simple:

B b;
if (b instanceof A) ...

What if we don't have an instance of B, but only the class itself?

I used to do it, but now I can't find it. I'm running on reflection and I need to determine if field.getType() is a subclass of some class.


Judging by this answer Need function isAssignableFrom

Scroll to Top