title: How do I determine if a class extends another class in Java?
body: <p>In Java how do I go about determining what classes a class extends?</p>
  
  <pre><code>public class A{
  }
  
  public class B extends A{
  }
  
  public class C extends A{
  }
  
  public class D{
  }
  
  public class E extends B{
  }
  
  public class doSomething{
  
      public void myFunc(Class cls){
           //need to check that cls is a class which extends A
           //i.e. B, C and E but not A or D
      }
  }
  </code></pre>
  
  <p>would <code>cls.getSuperClass()</code> do what I need?</p>