Are you looking for:
Super.class.isAssignableFrom(Sub.class)
More Related Contents:
- How to check if a subclass is an instance of a class at runtime? [duplicate]
- What is the ‘instanceof’ operator used for in Java?
- How do you find all subclasses of a given class in Java?
- Use of “instanceof” in Java [duplicate]
- What is the difference between instanceof and Class.isAssignableFrom(…)?
- Any reason to prefer getClass() over instanceof when generating .equals()?
- The performance impact of using instanceof in Java
- C++ equivalent of java’s instanceof
- Is it possible to use the instanceof operator in a switch statement?
- why java polymorphism not work in my example
- Java: Instanceof and Generics
- Is instanceof considered bad practice? If so, under what circumstances is instanceof still preferable?
- Inheritance in Java – creating an object of the subclass invokes also the constructor of the superclass. Why exactly?
- Why do I get “non-static variable this cannot be referenced from a static context”?
- Is it possible to call subclasses’ methods on a superclass object?
- How to avoid ‘instanceof’ when implementing factory design pattern?
- Calling superclass from a subclass constructor in Java
- Is there something like instanceOf(Class c) in Java?
- When do you need to explicitly call a superclass constructor?
- Private members in Java inheritance
- Check if an object is an instance of a class (but not an instance of its subclass)
- Understanding upper and lower bounds on ? in Java Generics
- Access subclass fields from a base class in Java
- Switch over type in java
- Test if object is instanceof a parameter type
- Java getMethod with subclass parameter
- instanceof Vs getClass( )
- Why can’t a “Class” variable be passed to instanceof?
- Why subclass in another package cannot access a protected method?
- Call protected method from a subclass of another instance of different packages